[英]Geospatial Index using MongoKit
Is there a way to create geospatial indexes over fields in a MongoKit Document
? 有没有一种方法可以在MongoKit
Document
字段上创建地理空间索引?
Right now I can't find any reference to do so using the indexes
descriptor. 现在,我无法使用
indexes
描述符找到任何引用。
I would like to have something like 我想吃点东西
class Foo(Document):
structure = {
'location': {
'lat': float,
'lon': float
}
}
indexes = [
{
'fields': ['location'],
'type': '2d'
}
]
It was documented . 它被记录在案 。
To create a geospatial index you need to: 要创建地理空间索引,您需要:
class Foo(Document):
structure = {
'location': {
'lat': float,
'lon': float
}
}
indexes = [
{
'fields': [('location', '2d'), ],
}
]
I had to look at the sources to realize this. 我必须看一下实现这一点的资源 。
Regards, 问候,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.