Details
-
Bug
-
Resolution: Gone away
-
Major - P3
-
None
-
4.2.3
-
None
-
ALL
Description
I use this aggregation for my collection
{
|
"$geoNear": {
|
"near": {
|
"type": "Point",
|
"coordinates": [ 38.975313, 45.03547 ],
|
},
|
"distanceField": "origin.distance",
|
"spherical": true,
|
"query": {
|
"trip": {
|
"$elemMatch": {
|
"point.pre": true,
|
"point.departure": \{ "$gt": new Date() }
|
}
|
}
|
}
|
}
|
}
|
and this indexes:
db.getCollection('sp_trips').createIndex({
|
"trip.point" : "2dsphere",
|
"trip.point.pre": 1,
|
"trip.point.departure": 1
|
})
|
It seems that indexes doesn't work.
For testing I created new indexes
db.getCollection('sp_trips').createIndex({
|
"trip.point.pre": 1,
|
"trip.point.departure": 1
|
})
|
and launch command
db.getCollection('sp_trips').find({
|
"trip": {
|
"$elemMatch": {
|
"point.pre": true,
|
"point.departure": \{ "$lt": new Date() }
|
}
|
}
|
}).count()
|
This works fine. But If I use elemMatch inside geoNear indexes doesn't work.