Jan 30th, 2012, 09:18 AM
spring data mongoDB geo-queries
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)
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.
Feb 2nd, 2012, 03:18 PM
Same problem due to RELEASE 1.0
I have a check in feature in my application that relies on mongodb queries using geo location data. My queries work with release candidate 1 spring mongodb jar files. However, when I upgrade to RELEASE 1.0, my queries return results that are not even close to being accurate for location criteria. I think there is a bug in the latest release of spring mongodb.
Feb 13th, 2012, 12:54 AM
I compiled a small tutorial on geospatial queries with Spring Data MongoDB recently. I did not encounter any of your problems w/ version 1.0.0-RELEASE.
Feb 13th, 2012, 02:17 AM
the tutorial is not doing queries like mine and if you read my message carefully you will find out the problem is when using geo query with other conditions, using mongoTemplate; not repository. (I construct the query Not the framework).
Tags for this Thread