2
我有一个数据结构集合名称locations
像:地理空间索引内部结构
{
"_id" : ObjectId("4e95263f1783ae8487be26d4"),
"name" : "test 1",
"location" : {
"coordinate" : {
"latitude" : 40.731987,
"longitude" : -73.999701
},
"address": "xxxxxxx"
}
}
,并希望进行地理查询,对location.coordinate
场。
当我尝试添加索引,我得到以下结果:
$> db.locations.ensureIndex({ "location.coordinate" : "2d" })
$> **** SyntaxError: syntax error (shell):0
是否可以使用地理空间索引这样的结构?
谢谢!它有帮助 –