> version()
version: 2.0.4
can't find special index: 2d for: { location: { $near: { $geometry: { type: "Point", coordinates: [ 0.1, 0.1 ] } }, $maxDistance: 5000.0 } }
> version()
version: 2.0.4
can't find special index: 2d for: { location: { $near: { $geometry: { type: "Point", coordinates: [ 0.1, 0.1 ] } }, $maxDistance: 5000.0 } }
> db.syncsnapshotsphere.find()
{ "_id" : "naga", "location" : { "type" : "Point", "coordinates" : [ 0.1, 0.1 ] }, "timestamp" : 1375778757.568005 }
{ "_id" : "nagb", "location" : { "type" : "Point", "coordinates" : [ 0.2, 0.2 ] }, "timestamp" : 1375778792.552187 }
{ "_id" : "nagc", "location" : { "type" : "Point", "coordinates" : [ 0.3, 0.3 ] }, "timestamp" : 1375778803.047879 }
{ "_id" : "nagd", "location" : { "type" : "Point", "coordinates" : [ 0.4, 0.4 ] }, "timestamp" : 1375778814.088595 }
> db.syncsnapshotsphere.find({location: {$near: {$geometry: {type: "Point", coordinates: [0.1,0.1]}}, $maxDistance: 5000}})
error: {
"$err" : "can't find special index: 2d for: { location: { $near: { $geometry: { type: \"Point\", coordinates: [ 0.1, 0.1 ] } }, $maxDistance: 5000.0 } }",
"code" : 13038
}
在第二行“版本...”之后不久,看起来很奇怪的“找不到特殊索引...”实际上是输出...我不知道为什么。
我试图弄清楚为什么我收到错误消息,说它正在尝试查找 2d 索引,因为位置字段上已经存在 2dsphere 索引...感谢所有帮助。
> db.syncsnapshotsphere.getIndexes()
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"ns" : "logging_stuff.syncsnapshotsphere",
"name" : "_id_"
},
{
"v" : 1,
"key" : {
"location" : "2dsphere"
},
"ns" : "logging_stuff.syncsnapshotsphere",
"name" : "location_2dsphere",
"background" : false,
"dropDups" : false
}
]
>