我已经阅读了文档,但它没有按预期工作。我有6400万这些文件都有不同的“millisecos”:
{
"_id" : ObjectId("5396e85c12f43f5d1bafbd13"),
"author" : ObjectId("5396ca2b0fe95cf96599d881"),
"location" : {
"type": "Point",
"coordinates" : [
12.52891929999998,
16.620259
]
},
"name": "Jordan",
"description" : "aDescription"
}
我在Mongo中有以下3个索引:
{
// index on the _id
"location" : "2dsphere",
// compound index on location and time_1
}
如何快速查询复合索引以获取不同的“名称”?我获取所有适用文件的查询是:
db.mycollection.find({"location":{"$geoWithin": {"$centerSphere": [-83.3434343,24.34343], 0.5}}, "millisecos": {"$gt": 1399522511000, "$lt":1399526111000}})
我不知道如何找到我想要的作者的独特“名字”。
速度慢,索引应该有帮助吗?我该如何快速完成? (没有分片)。如果查询不好,我愿意接受其他建议。是限制帮助还是跳过?
查询计划:
{
"cursor": "S2Cursor",
"isMultiKey": true,
"n": 70394,
"nscannedObjects": 70394,
"nscanned": 10479843,
"nscannedObjectsAllPlans":70394
"scanAndOrder": false,
"nYields": 141,
"millis": 175250,
"indexBounds": { },
"nscanned": 10479843,
"matchTested": NumberLong(10024353),
"geoTested": NumberLong(60348),
"cellsInCover": NumberLong(26),
"server": mongo-cluster.excelmicro:27017
}