Unable to perform geospatial queries
See original GitHub issueWhen trying to issue a geospatial query using ‘near’ you get back an error “Can’t use $near”. I have also tried with geoNear and nearSphere as well.
Example:
var Schema = new mongoose.Schema({
placeName: String,
geo: {
type: { type: String, enum: "Point", default: "Point" },
coordinates: { type: [ Number ], default: [ 0,0 ] }
}
});
somemodel.where('geo').near({ center: [50, 50] }).exec(function(err, locs){
console.log(locs);
})
The above will return: [Error: Can’t use $near]
I have also tried the following:
model.find({
geo: {
$near: {
$geometry: {
type: "Point",
coordinates: [50, 50]
},
$maxDistance: maxDistance
}
}
}, function(err, locs) {
console.log(locs);
});
It will also result in the same error: [Error: Can’t use $near]
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:17
Top Results From Across the Web
Unable to execute queries on geospatial atributes - MongoDB
So, I have two collections using geospatial indexes, and I'm trying to execute a $near query, but MongoDB can't find the indexes.
Read more >Unable to make geospatial query (within) with spring-boot ...
Unable to make geospatial query (within) with spring-boot, ... i've read hibernate documentation, but i'm unable to make the query works.
Read more >Performing geospatial queries at scale | by Sander Mulders
Able to support indexing and querying geospatial shapes, in particular points, polygons and multipolygons at scale;; Able to filter based on the ...
Read more >Azure CosmosDB MongoDB Api GeoSpatial queries not working
My understanding is that you are not able to query Geospatial data in Azure Cosmos DB MongoDB API. Geospatial queries are supported in...
Read more >Geospatial troubleshooting - Amazon QuickSight
If Amazon QuickSight doesn't recognize your geospatial data as geospatial, use this section to help troubleshoot the issue. Make sure that your data...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Looks like this was just an instance of a missing query operator for single embedded subdocs, much like #4044. Will be fixed when 4.4.14 is released.
Thanks for the repro instructions @angelo0000, I’m on it 😃