草庐IT

2dSphere

全部标签

node.js - MongoError : can't find any special indices: 2d (needs index), 2dsphere(需要索引)$nearSphere

这是我的第一个问题,所以如果问得不是很好或者我的英语不好,请耐心等待我。我正在尝试在Node.js中的MongoDB中执行地理空间查询。这个查询工作得很好collection.find({loc:{$geoWithin:{$centerSphere:[[point.coordinates[0],point.coordinates[1]],getRadiusMeters(radius)]}}})但是当我尝试对$nearSphere做同样的事情时:collection.find({loc:{$nearSphere:{$geometry:{type:"Point",coordinates:[

mongodb - 查询返回错误结果

我遇到了在多边形(简单框)内匹配项目的问题。我不明白为什么查询框中的项目没有生成。所以这就是我所拥有的:>db.testing.getIndexes();{"0":{"v":1,"key":{"_id":1},"ns":"test.testing","name":"_id_"},"1":{"v":1,"key":{"point":"2dsphere"},"ns":"test.testing","name":"2dsphere_index"}}这是我的文件(我测试过不同的格式):>db.testing.find();{"_id":ObjectId("5439c9c61120c95f4c5

mongodb - 无法将 2dSphere 索引添加到位置数组

我正在尝试将2dSphere索引添加到包含位置数组的Mongo集合。这是我得到的错误:[MongoError:insertDocument::causedby::16755Can'textractgeokeysfromobject,malformedgeometry?:{_id:"gjuFiwHd7ctBpgEwL",title:"Inyorpletaoland.",locations:[{loc:{type:"Point",coordinates:["0.0181033","43.8355792"]}}]}]我打电话的地方:ensureIndex({'locations.loc':"

php - 嵌套数组字段的 Mongodb 2dsphere 索引

我创建了一个集合,一个对象看起来像这样。[_id]=>MongoIdObject([$id]=>53087f483b15eaeb6c3c9869)[time_from]=>2014-02-2200:00:00[time_to]=>2014-02-2200:10:00[checkin]=>Array([0]=>Array([time_frame]=>2014-02-2200:00:56[user_id]=>1[loc]=>Array([type]=>Point[coordinates]=>Array([0]=>73.43[1]=>42.22)))[1]=>Array([time_fram

具有稀疏复合索引错误 13311 的 MongoDB $near 地理空间查询

我创建了一个支持地址预测的查询,类似于GooglePlaces自动完成,其中输入字段将尝试通过在集合中查找最近的匹配地址(基于geo-ip-location)来预测正在输入的地址.我收藏中的每个文档都包含一个地址字符串和地址坐标,但并非每个文档都有地址或坐标。该集合还包括一个按如下方式创建的复合索引:db.collection.ensureIndex({address:1,coordinates:"2dsphere"},{sparse:true,background:true});我的问题是当我执行查询时,如果结果集包含一个具有地址字段但没有坐标字段的文档,我会收到以下错误:{$err

Mongodb 复合 2dsphere 索引无法按预期工作

我有一个名为search2的集合,其中包含大约20000个这样的文档:{"loc":{"type":"Polygon","coordinates":[[[43.78526674007639,11.14739998758569],[43.78526674007639,11.183372851822439],[43.79443488391605,11.183372851822439],[43.79443488391605,11.264311796355125],[43.812771171595415,11.264311796355125],[43.83110745927479,11.264

MongoDb geoIntersects 不使用 IndexOnly

我有一个名为search2的集合,其中包含大约20000个这样的文档:{"loc":{"type":"Polygon","coordinates":[[[43.78526674007639,11.14739998758569],[43.78526674007639,11.183372851822439],[43.79443488391605,11.183372851822439],[43.79443488391605,11.264311796355125],[43.812771171595415,11.264311796355125],[43.83110745927479,11.264

Mongodb 地理空间索引,2d 与 2dsphere

根据它关于2d索引的文档:The2dindexsupportscalculationsonaflat,Euclideanplane.The2dindexalsosupportsdistance-onlycalculationsonasphere,butforgeometriccalculations(e.g.$geoWithin)onasphere,storedataasGeoJSONobjectsandusethe2dsphereindextype.有些事情我不明白..我不明白仅距离是什么意思,它是指弦(通过表面“内部”的线连接两个表面点的线)吗?该计算如何根据地球经度和纬度进行计算

包含多个位置的 MongoDB 和 2dsphere 索引

在MongoDB集合中,我想在包含许多位置的字段上创建2dsphere索引。我认为这一定是可行的,因为$geoNear阶段运算符有includeLocs或uniqueDocs之类的选项,我们可以指定这些选项一些条件,如果位置字段有多个位置。然后我尝试在字段loc上创建索引,如下所示://db.users{//otherfieldsloc:[{type:"Point",coordinates:[-20,20]},{type:"Point",coordinates:[-30,30]}]}使用代码:db.users.createIndex({loc:"2dsphere"})但我得到的错误是l

MongoDB 索引 : Multiple single-field vs single compound?

我有一组地理空间+时间数据和一些附加属性,我将在map上显示这些数据。该集合目前有几百万份文件,并且会随着时间的推移而增加。每个文档都有以下字段:位置:[geojson对象]日期:[日期对象]缩放级别:[int32]条目类型:[ObjectID]我需要能够通过位置(通常是地理范围内查询)、日期(通常是$gte/$lt)、ZoomLevel和EntryType的任意组合来快速查询此集合。我想知道的是:我应该制作一个包含所有四个字段的复合索引,还是为每个字段制作一个索引,或者它们的某种组合?我在MongoDB文档中阅读了以下内容:Foracompoundindexthatincludesa