Skip to content

Add Hint annotation #4339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Add Hint annotation #4339

wants to merge 2 commits into from

Conversation

christophstrobl
Copy link
Member

This commit introduces the @Hint annotation that allows to override MongoDB's default index selection for repository query, update and aggregate operations.

@Hint("lastname-idx")
List<Person> findByLastname(String lastname);

Closes: #3230

This commit introduces the new `@Hint` annotation that allows to override MongoDB's default index selection for repository query, update and aggregate operations.

```
@hint("lastname-idx")
List<Person> findByLastname(String lastname);

@query(value = "{ 'firstname' : ?0 }", hint="firstname-idx")
List<Person> findByFirstname(String firstname);
```

Closes: #3230
mp911de pushed a commit that referenced this pull request Apr 13, 2023
This commit introduces the new `@Hint` annotation that allows to override MongoDB's default index selection for repository query, update and aggregate operations.

```
@hint("lastname-idx")
List<Person> findByLastname(String lastname);

@query(value = "{ 'firstname' : ?0 }", hint="firstname-idx")
List<Person> findByFirstname(String firstname);
```

Closes: #3230
Original pull request: #4339
mp911de added a commit that referenced this pull request Apr 13, 2023
Reformat code. Make getAnnotatedHint non-nullable.

See #3230
Original pull request: #4339
@mp911de mp911de added the type: enhancement A general enhancement label Apr 13, 2023
@mp911de mp911de added this to the 4.1 RC1 (2023.0.0) milestone Apr 13, 2023
@mp911de mp911de closed this Apr 13, 2023
@mp911de mp911de deleted the issue/3230 branch April 13, 2023 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to specify index for query by MongoRepository [DATAMONGO-2373]
2 participants