草庐IT

Coordinates

全部标签

node.js - Mongoose :MongoError 没有地理搜索索引

我使用的是Mongoose5.1.5版,Mongodb3.0.10版当我使用mongooseModel.geoSearch方法时,它给我一个错误,说MongoError:NogeoSearchIndex下面是架构varhotelSchema=newmongoose.Schema({name:{type:String,required:true},stars:{type:Number,min:0,max:5,"default":0},services:[String],description:String,photos:[String],currency:String,reviews:[

c# - MongoDb改变数组元素的顺序

我经常使用MongoDb地理空间索引,现在我正在用官方10genCSharp驱动程序替换旧的NoRM框架。我遇到的问题是,对于由NoRM处理的现有数据,坐标的顺序[y,x]相反,官方驱动程序似乎不喜欢它。所以对于现有的数据,我有这样的结构:{"Coordinates"[:{"Longitude":-85.68216,"Latitude":38.221452},//..morecoordinates]}所以我的问题是,如何修改数组中所有元素的顺序,使它们看起来像:{"Coordinates"[:{"Latitude":38.221452,"Longitude":-85.68216},//

node.js - Node ,js - Mongoose - 无法保存地理多边形 - CastError : Cast to number failed

我正在尝试将地理点和地理多边形保存到Mongo。我的点测试通过,但多边形失败:CastError:Casttonumberfailedforvalue"0,0,3,0,3,3,0,3,0,0"atpath"coordinates"我的架构如下:varGeoSchema=newSchema({name:String,coordinates:[Number]});GeoSchema.index({coordinates:'2dsphere'});我成功保存的测试点对象:geoPoint=newGeo({coordinates:[2,2],type:'Point'});无法保存的我的测试多边

Mongodb $geoIntersect 问题

我有一个集合,其属性为“place”,如下所示。"place":{"name":"CentralRegion","country":"Country_A","coor_type":"Polygon","coordinates":[[[103.749959507073,1.2123138339349],[103.918426999964,1.2123138339349],[103.918426999964,1.36874499902569],[103.749959507073,1.36874499902569]]]}我正在尝试使用$geoInterset运算符来获取文档列表,其中plac

php - PHP Mongo 聚合中的多个 $match

我在Mongo聚合查询中使用$match两次时遇到问题。当查询输入数组时,它似乎用第二个$match覆盖了第一个$match,因此查询不正确。有没有办法查询两个匹配项?$aggArray=array(array('$match'=>array('payload.location.coordinates.0'=>array('$gte'=>$longmin,'$lte'=>$longmax),'payload.location.coordinates.1'=>array('$gte'=>$latmin,'$lte'=>$latmax),'time'=>array('$gte'=>newM

php - PHP 中的 MongoDB 查询

我已经阅读了几个与我相同的问题,但我仍然不明白如何在PHP中查询MongoDB,因为我是这两个平台的新手。这是我在MongoDB中的查询db.tweets.find({},{"coordinates.coordinates":1});我最初的PHP代码$document=$collection->find({},{"coordinates.coordinates":1});foreach($documentas$doc){var_dump($doc);}我的代码返回错误Parseerror:syntaxerror,unexpected'{'inC:\xampp\htdocs\gmaps

python - Mongo 集合查询和运算符

在我的收藏中,我只想返回记录中包含位置或地点信息(包括坐标)的记录。因此,如果任一条件不为空,则在两个条件均不为空的情况下检索其中一个或两个字段。到目前为止我的查询是这样的:cursor=coll.find({"$or":[{"place.bounding_box.type":{"$ne":None}},{"coordinates.type":{"$ne":None}}]},{"coordinates.coordinates":1},{"place.bounding_box.coordinates":1},tailable=True,timeout=False)但是我得到了这个pymo

javascript - 如何在 $geoNear 之后填充子文档

我正在使用NodeJs和Mongoose并构建一个功能来列出附近的交易。Deal.db.db.command({"geoNear":Deal.collection.name,"near":[23,67],"spherical":true,"distanceField":"dis"},function(err,documents){if(err){returnnext(err);}console.log(documents);});交易模式:vardealSchema=newmongoose.Schema({title:String,merchant:{type:mongoose.Sch

mongodb - Sails.js $near 查询不起作用并要求索引

我正在尝试使用MongoDB查询Sails.js中某个坐标的最近点,但出现以下错误:{[MongoError:can'tfindanyspecialindices:2d(needsindex),2dsphere(needsindex),for:{$near:{$geometry:{type:"Point",coordinates:["4.3795912","51.9985675"]},$maxDistance:1000}}]name:'MongoError'}我确定我在bootstrap.js中有这个:sails.models.location.native(function(err,

arrays - 使用 mongodb 项目数组内容

我的问题是,当我使用MongoDB二维索引作为坐标时,一切正常,但JSON输出不是我想要的。varschema=newSchema({location:{type:[Number],//[,]index:'2d',required:false}});**desiredoutput**{"_id":"xxx","longitude":18.056974411010742,"latitude":54.31120601701069,}**whatiget**{"_id":"xxx","location":[18.056974411010742,54.31120601701069]}**Wha