-
Notifications
You must be signed in to change notification settings - Fork 1.1k
DATAMONGO-1245 - Add support for Query By Example. #341
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prepare issue branch.
!!! ATTENTION !!! This is just an explorative approach to QBE trying find possibilities and limitations. Since o.s.d.domain.Example needs to be in spring-data-commons one has to run the build with bundlor disabled '-Dbundlor.enabled=false'. !!! ATTENTION !!! We now support querying documents by providing a sample of the given object holding compare values. For the sake of partial matching we flatten out nested structures so we can create different queries for matching like: { _id : 1, nested : { value : "conflux" } } { _id : 1, nested.value : { "conflux" } } This is useful when you want so search using a only partially filled nested document. String matching can be configured to wrap strings with $regex which creates { firstname : { $regex : "^foo", $options: "i" } } when using StringMatchMode.STARTING along with the ignoreCaseOption. DBRefs and geo structures such as Point or GeoJsonPoint is converted to their according structure.
Rename methods on Example and introduce PropertySpecifiers. Move mapping to separate class.
Introduced MongoRegexCreator. Added some javadoc. Still need to do reference documentation.
@gregturn Can you have a look on the docs pls? |
* Query predicates are combined using the `AND` keyword | ||
* No support for nested/grouped property constraints like `firstname = ?0 or (firstname = ?1 and lastname = ?2)` | ||
* Limited to starts/contains/ends/regex matching for strings and exact matching for other property types | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of repeating "Limited to...", say "Only supports..."
0c6e7ad
to
1fd87ed
Compare
Adopt changes from query by example API refactoring. Related ticket: DATACMNS-810.
1fd87ed
to
34a58e0
Compare
34a58e0
to
1692268
Compare
1f6f0d2
to
333ef65
Compare
333ef65
to
6be07ad
Compare
@@ -254,8 +261,8 @@ protected DBObject getMappedKeyword(Field property, Keyword keyword) { | |||
boolean needsAssociationConversion = property.isAssociation() && !keyword.isExists(); | |||
Object value = keyword.getValue(); | |||
|
|||
Object convertedValue = needsAssociationConversion ? convertAssociation(value, property) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be formatting only.
798d153
to
c9b6344
Compare
odrotbohm
pushed a commit
that referenced
this pull request
Mar 17, 2016
An explorative approach to QBE trying find possibilities and limitations. We now support querying documents by providing a sample of the given object holding compare values. For the sake of partial matching we flatten out nested structures so we can create different queries for matching like: { _id : 1, nested : { value : "conflux" } } { _id : 1, nested.value : { "conflux" } } This is useful when you want so search using a only partially filled nested document. String matching can be configured to wrap strings with $regex which creates { firstname : { $regex : "^foo", $options: "i" } } when using StringMatchMode.STARTING along with the ignoreCaseOption. DBRefs and geo structures such as Point or GeoJsonPoint is converted to their according structure. Related tickets: DATACMNS-810. Original pull request: #341.
odrotbohm
pushed a commit
that referenced
this pull request
Mar 17, 2016
Adopt changes from query by example API refactoring. Related tickets: DATACMNS-810. Original pull request: #341.
odrotbohm
added a commit
that referenced
this pull request
Mar 17, 2016
Adapt to API changes in Spring Data Commons. Related tickets: DATACMNS-810. Original pull request: #341.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We now support querying documents by providing a sample of the given object holding compare values.
For the sake of partial matching we flatten out nested structures (depending on the configured
NullHandler
) so we can create different queries for matching like:This is useful when you want so search using a only partially filled nested document.
Usage of
StringMatcher
allows usage of$regex
operator.DBRefs
and geo structures such asPoint
orGeoJsonPoint
are converted to their according structure.Requires: spring-projects/spring-data-commons#153 (DATACMNS-810)