I'm attempting to return documents by doing a query $or on different fields including a $near query with problems.
Schema
locationSchema{
...
beacon: String,
access_point: String,
gps: [],
...
}
locationSchema.index({ gps: '2dsphere' });
Query
locations.find({
'$or': [
{
gps: {
'$near': {
'$geometry': {
type: 'Point',
coordinates: [
13.1313131,
-4.444444
]
},
'$maxDistance': 50,
distanceField: 'distance',
spherical: true
}
}
},
{
access_point: '88:A6:BB:26:95:11'
},
{
access_point: '88:A6:C6:26:CC:21'
}
]
},
function(err,locations){
//DosomethingwithfoundLocations
});
If I just do a query with only the $near
input, there is one location returned as expected and if I do the query with just the list of access_point
's there is one location returned, but not when both queries are run at the same time.
I'm assuming this is a bug, but is there anyway I can get this type of query working?
Thanks
via Dean Meehan
No comments:
Post a Comment