Results 1 to 4 of 4

Thread: spring data mongoDB geo-queries

  1. #1
    Join Date
    Jan 2011
    Posts
    3

    Default 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.

  2. #2

    Default 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. #3
    Join Date
    Jan 2011
    Location
    codecentric AG, Germany
    Posts
    17

    Default

    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.

    http://blog.codecentric.de/en/2012/0...atial-queries/

    HTH,
    Tobias

  4. #4
    Join Date
    Jan 2011
    Posts
    3

    Default

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

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
  •