-
Jan 30th, 2012, 09:18 AM
#1
spring data mongoDB geo-queries
hey guys:
I've been working on spring data mongoDb 1.0.0-RELEASE, I have some geo queries that retrieves documents on tow conditions
the first one is creation date must be in last 24 hours and the second is the near the user location
so my query is like this:
new Query(Criteria.where(dtCreated).gte(new Date(System.currentTimeMillis() - 24*3600)).and(location).nearSphere(new Point(longitude, latitude)) .maxDistance(
new Distance(radius, Metrics.MILES)
.getNormalizedValue())).skip(10*page).limit(10);
this query returned only by date not considering location and extremely beyond max distance:
and I couldn't solve it any way other than using the and operator method and adding a less than condition on date, then adding the geo condition and method.
if any one knows why this is happening please reply.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules