Announcement Announcement Module
No announcement yet.
spring data mongoDB geo-queries Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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)

    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.

  • #2
    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.


    • #3
      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.



      • #4
        Hi Tobias,
        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).