You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the current behavior?
Setting up a '2dsphere' index doesn't seem to be working
I'm trying to set up a schema and query some documents that I've inserted with proper geoJSON structure, however when I try to query but $near I get this error message:
Sort: {}
Proj: {}
planner returned error: unable to find index for $geoNear query
at queryCallback (/Users/edjroz/Repos/.tnp/cityapp-gcp/node_modules/mongodb-core/lib/cursor.js:244:25)
at /Users/edjroz/Repos/.tnp/cityapp-gcp/node_modules/mongodb-core/lib/connection/pool.js:544:18
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'MongoError',
message: 'error processing query: ns=ca.dummy2Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0\nSort: {}\nProj: {}\n planner returned error: unable to find index for $geoNear query',
ok: 0,
errmsg: 'error processing query: ns=ca.dummy2Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0\nSort: {}\nProj: {}\n planner returned error: unable to find index for $geoNear query',
code: 2,
codeName: 'BadValue' }
using schema.indexes() gives me the output [ [ { location: '2dsphere' }, { background: true } ] ]
however if I try to go check indexes on mongo by using the CLI db.example.getIndexes() it returns an empty array []
It seems that my query was the mistake, I noticed right after posting this. the query tries to find the key loc which doesn't exist in the model schema.
What is the current behavior?
Setting up a '2dsphere' index doesn't seem to be working
I'm trying to set up a schema and query some documents that I've inserted with proper geoJSON structure, however when I try to query but $near I get this error message:
using
schema.indexes()
gives me the output[ [ { location: '2dsphere' }, { background: true } ] ]
however if I try to go check indexes on mongo by using the CLI
db.example.getIndexes()
it returns an empty array[]
What is the expected behavior?
query any documents close to that location
Please mention your node.js, mongoose and MongoDB version.
mongo: 3.4.0
NodeJs: Carbon LTS (8.9.4)
Mongoose: 5.1.3
The text was updated successfully, but these errors were encountered: