存储地理空间数据的键值模式?
开发一个桥梁以将 cms 与 MongoDB 结合使用我使用存储键、值、类型来管理链接到 cms 的所有值。这些键、类型值存储在 web.config
中以允许可扩展架构。在这种情况下,不允许类对象定义来保留动态模式。结果是作为 DynamicArray 存储。这产生了一些关于使用 Query.Near 运算符以执行方式检索纬度经度的执行和存储的疑问。
DynamicArray
{
item : { Key: "lat", Value: "12.897", Type:double }
item : { Key: "lng", Value: "12.345", Type:double }
item : { Key: "country", Value: "USA", Type:String }
item : { Key: "state", Value: "CA", Type:String }
item : { Key: "city", Value: "San Jose", Type:String }
item : { Key: "district", Value: "", Type:String }
}
Query.ElemMatch("DynamicArray", Query.And(Query.EQ("Key", "country"), Query.EQ("Value", "USA")));
Query.Near ??
它是与地理空间搜索兼容的模式键值吗?并且表现出色?如何使用官方驱动程序以这种模式方式查询Query.Near
(C#官方驱动程序)?
谢谢。
Developing a bridge to use a cms with MongoDB I use a storage key, value, type to manage all values linked to the cms. These key, types values are stored in the web.config
to allow an extensible schema. No class object definition is allowed in this case to preserve the dynamic schema. The result is a storage as DynamicArray. This is generating some doubs about performing and the storage of latitude longitude to retrieve in a peform way using Query.Near
operators.
DynamicArray
{
item : { Key: "lat", Value: "12.897", Type:double }
item : { Key: "lng", Value: "12.345", Type:double }
item : { Key: "country", Value: "USA", Type:String }
item : { Key: "state", Value: "CA", Type:String }
item : { Key: "city", Value: "San Jose", Type:String }
item : { Key: "district", Value: "", Type:String }
}
Query.ElemMatch("DynamicArray", Query.And(Query.EQ("Key", "country"), Query.EQ("Value", "USA")));
Query.Near ??
It's a schema key value compatible with a GeoSpatial searching? And performant? How to query using official driver a Query.Near
(C# official driver) in this schema way ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了在 MongoDB 上使用地理空间查询,您需要将 x,y 坐标存储为对象中的前两个值。有效模式的示例有:
您不能像在上面的示例中所做的那样将坐标分成多个对象。
有关更多信息: http://www.mongodb.org/display/DOCS/Geospatial+Indexing
In order to use geo-spatial queries on MongoDB, you need to store your x,y coordinates as the first two values in an object. Examples of valid schemas are:
You cannot separate the coordinates into multiple objects as you have done in your sample above.
For more information: http://www.mongodb.org/display/DOCS/Geospatial+Indexing