-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: 2.1.0
-
Component/s: Querying
-
None
-
Environment:Windows 7 32 bit
-
ALL
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
I am getting errors when I try a spatial query within an "$and" operator.
I can run the following queries successfully:
db.LOGGER.find({ "COORDINATES" : { "$within" :
{ "$polygon" : [[22000, 60000], [22000, 63000], [23000, 63000], [23000, 60000]] } } });
db.LOGGER.find({ "$and" : [{ "TIME" :
}, { "TIME" :
{ "$lt" : NumberLong("3542546575557") }}] });
However when I add the spatial query to the "$and" I get the following error:
db.LOGGER.find({ "$and" : [{ "COORDINATES" : { "$within" :
{ "$polygon" : [[22000, 60000], [22000, 63000], [23000, 63000], [23000, 60000]] }} },{ "TIME" :
{ "$gte" : NumberLong("3542546522557") }}, { "TIME" :
{ "$lt" : NumberLong("3542546575557") }}] });
error: {
"$err" : "can't find special index: 2d for: { $and: [ { COORDINATES: { $within:
} }, { TIME:
{ $gte: 3542546522557 }}, { TIME:
{ $lt: 3542546575557 } } ] }",
"code" : 13038
}
I have a collection with the following format:
{
"_id" : ObjectId("4f7c7a07d2fdb8c2db481a24"),
"ID_NAME" : NumberLong(0),
"SYSTEM_REFERENCE" : "0",
"TIME" : NumberLong("3542546568559"),
"COORDINATES" :
}
There is a 2d spatial index on "COORDINATES"
Indexes are:
db.LOGGER.getIndexes()
[
{
"name" : "id",
"ns" : "TEST.LOGGER",
"key" :
,
"v" : 0
},
{
"_id" : ObjectId("4f7c7b5aa22c3db066674ba0"),
"ns" : "TEST.LOGGER",
"key" :
,
"name" : "Coord",
"min" : 0,
"max" : 101000
}
]