Skip to content
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

MongoDB $near doesn't work inside $and operator #3604

Closed
m0g opened this issue Jan 30, 2015 · 1 comment
Closed

MongoDB $near doesn't work inside $and operator #3604

m0g opened this issue Jan 30, 2015 · 1 comment

Comments

@m0g
Copy link

m0g commented Jan 30, 2015

Hello,

I'm trying to do a geospatial query within an $and operator on the server side:

var query = { $and: [
  {
    fromLoc: { $near : { 
      $geometry: { 
        type : "Point" ,
        coordinates: fromCoords
      },
      $maxDistance : 50,
      $minDistance : 10
    }}
  },
  {
    toLoc: { $near : { 
      $geometry: { 
        type : "Point" ,
        coordinates: toCoords
      },
      $maxDistance : 50,
      $minDistance : 10
    }}
  }
]};

return Lifts.find(query);

Problem is that Mongo is telling me that it can't find any special indices 2d (needs index) 2dsphere (needs index)

I've google around, and it seems that it's a bug from MongoDB 2.4, and that it has been corrected in newer version. However since Mongo is bundled with Meteor, I have no idea how I can update mongo itself.

Thanks

@glasser
Copy link
Contributor

glasser commented Feb 5, 2015

You can run current versions of Meteor against your own Mongo 2.6 server and just about everything will work (some upserts won't, see #2278), but the default server used by the dev mode runner will still be 2.4. I am in the process of upgrading the default used by Meteor to 2.6; this is being tracked in #2036.

@glasser glasser closed this as completed Feb 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants