A simple question:
What is the correct way to create a geospatial query from mongoose to nodejs?
Complicated story:
I created a mongoose diagram with a spatial index
var MySchema = newSchema({
location : {
type : [ Number ],
required : true,
index : '2d'
},
});
Then I inserted into table 3 of the document. I can get these documents with both the mongo client and the mongoose using db.mymodels.find({})andMyModel.find({});
Now I'm trying to make a geospatial query with a bounding box.
db.mymodels.find({location: {$within: {$box: box}}})
returns only one result, as expected, in a field.
Mongoose, on the other hand, returns all three results
query = MyModel.where({location: {$within : {$box : box}}});
query.run(cb)
, find() ,
find , 'need an area > 0'
, , .
?
?