【发布时间】:2011-12-05 20:38:43
【问题描述】:
我有一个集合名称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
这种结构可以使用地理空间索引吗?
【问题讨论】:
标签: mongodb indexing geospatial