Skip to content

DATAMONGO-1110 - Add support for $minDistance. #277

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 5 commits into from

Conversation

christophstrobl
Copy link
Member

We now support $minDistance for NearQuery and Criteria. Please keep in mind that $minDistance is only available for MongoDB 2.6 and better and can only be combined with $near or $nearSphere operator depending on the defined index type. Usage of $minDistance with NearQuery is only possible when a 2dsphere index is present.

Further on query derivation now allows a 2nd Distance parameter for the near keyword. This allows to define near queries like:

findByLocationNear(Point point, Distance min, Distance max);

The first Distance parameter is treated as the minimum distance while the second one defines the maximum distance from the given point, while the distance parameter will server as maximum distance in case only one Distance parameter is provided.

@odrotbohm odrotbohm force-pushed the issue/DATAMONGO-1110 branch from 8334e00 to e8f4288 Compare March 4, 2015 17:02
odrotbohm added a commit that referenced this pull request Mar 4, 2015
Moved to newly introduced Range type in Spring Data Commons to more safely bind minimum and maximum distances. Changed internal APIs to always use a Range<Distance> which gets populated based on the method signature's characteristics: if only one Distance parameter is found it's interpreted as a range with upper bound only.

Original pull request: #277.
@odrotbohm odrotbohm force-pushed the issue/DATAMONGO-1110 branch from e8f4288 to 155a53a Compare March 5, 2015 07:46
odrotbohm added a commit that referenced this pull request Mar 5, 2015
Moved to newly introduced Range type in Spring Data Commons to more safely bind minimum and maximum distances. Changed internal APIs to always use a Range<Distance> which gets populated based on the method signature's characteristics: if only one Distance parameter is found it's interpreted as a range with upper bound only.

Original pull request: #277.
@odrotbohm odrotbohm force-pushed the issue/DATAMONGO-1110 branch from 155a53a to e493adc Compare March 5, 2015 07:46
odrotbohm added a commit that referenced this pull request Mar 5, 2015
Moved to newly introduced Range type in Spring Data Commons to more safely bind minimum and maximum distances. Changed internal APIs to always use a Range<Distance> which gets populated based on the method signature's characteristics: if only one Distance parameter is found it's interpreted as a range with upper bound only.

Original pull request: #277.
odrotbohm added a commit that referenced this pull request Mar 5, 2015
Moved to newly introduced Range type in Spring Data Commons to more safely bind minimum and maximum distances. Changed internal APIs to always use a Range<Distance> which gets populated based on the method signature's characteristics: if only one Distance parameter is found it's interpreted as a range with upper bound only.

Removed invalid testcase for minDistance on 2d index.

Original pull request: #277.
christophstrobl and others added 5 commits March 5, 2015 14:54
We now support $minDistance for NearQuery and Criteria. Please keep in mind that minDistance is only available for MongoDB 2.6 and better and can only be combined with $near or $nearSphere operator depending on the defined index type. Usage of $minDistance with NearQuery is only possible when a 2dsphere index is present.
It is now possible to use two distance parameter within the repository queries. This allows to define near queries like:

findByLocationNear(Point point, Distance min, Distance max);

Please note that the first distance parameter is treated as the minimum distance while the second one defines the maximum distance from the given point, while the distance parameter will server as maxDistance in case only one Distance is provided.
Moved to newly introduced Range type in Spring Data Commons to more safely bind minimum and maximum distances. Changed internal APIs to always use a Range<Distance> which gets populated based on the method signature's characteristics: if only one Distance parameter is found it's interpreted as a range with upper bound only.

Removed invalid testcase for minDistance on 2d index.

Original pull request: #277.
We now make sure $minDistance operator gets correctly nested when using GeoJSON types.

Original pull request: #277.
christophstrobl added a commit that referenced this pull request Mar 5, 2015
We now support $minDistance for NearQuery and Criteria. Please keep in mind that minDistance is only available for MongoDB 2.6 and better and can only be combined with $near or $nearSphere operator depending on the defined index type. Usage of $minDistance with NearQuery is only possible when a 2dsphere index is present. We also make sure $minDistance operator gets correctly nested when using GeoJSON types.

It is now possible to use a Range<Distance> parameter within the repository queries. This allows to define near queries like:

findByLocationNear(Point point, Range<Distance> distances);

The lower bound of the range is treated as the minimum distance while the upper one defines the maximum distance from the given point. In case a Distance parameter is provided it will serve as maxDistance.

Original pull request: #277.
odrotbohm added a commit that referenced this pull request Mar 5, 2015
Moved to newly introduced Range type in Spring Data Commons to more safely bind minimum and maximum distances. Changed internal APIs to always use a Range<Distance> which gets populated based on the method signature's characteristics: if only one Distance parameter is found it's interpreted as a range with upper bound only.

Removed invalid testcase for minDistance on 2D index.

Original pull request: #277.
@odrotbohm odrotbohm closed this Mar 5, 2015
@odrotbohm odrotbohm deleted the issue/DATAMONGO-1110 branch March 5, 2015 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants