2dsphere

Mongodb find query with $near and coordinates not working

…衆ロ難τιáo~ 提交于 2021-02-18 22:21:07
问题 I'm trying to make use of some geolocation functionality in mongodb. Using a find query with $near doesn't seem to work! I currently have this object in my database: { "Username": "Deano", "_id": { "$oid": "533f0b722ad3a8d39b6213c3" }, "location": { "type": "Point", "coordinates": [ 51.50998, -0.1337 ] } } I have the following index set up as well: { "v": 1, "key": { "location": "2dsphere" }, "ns": "heroku_app23672911.catchmerequests", "name": "location_2dsphere", "background": true } When I

why i make a 2dsphere index ,but when i query it shows s2cursor?

拜拜、爱过 提交于 2020-01-03 05:47:08
问题 why i make a 2dsphere index ,but when i query it shows s2cursor, i think it should be geosearchcursor. the mongodb document says this: http://docs.mongodb.org/manual/reference/method/cursor.explain/#explain-output-fields-core cursor is a string that reports the type of cursor used by the query operation: BasicCursor indicates a full collection scan. BtreeCursor indicates that the query used an index. The cursor includes name of the index. When a query uses an index, the output of explain()

MongoDB version 2.6 still fails on 2dsphere geoindexing citing inability to extract geokeys and possible malformed geometry

半腔热情 提交于 2019-12-11 07:22:56
问题 I had been getting the referenced error under version 2.4 with a different lon/lat data set. I upgraded to 2.6 and was able to use 2dsphere index on that data set. However, with a different data set (excerpt below) I received the old error message on trying to index using 2dshpere. the error message excerpt is as follows: I am having the same problem receiving the error: can't extract geokeys from object; malformed geometry?. The object is the following, which validated on on GeoJSONLint.com.

Mongodb Sphere index rejects my object

烈酒焚心 提交于 2019-12-11 02:25:33
问题 Hi i have an COllection with an 2d sphere index wayCollection.createIndex(new BasicDBObject("poly", "2dsphere")); i when i try to insert a certain object i get an error: Exception in thread "main" com.mongodb.WriteConcernException: { "serverUsed" : "localhost:27017" , "ok" : 1 , "n" : 0 , "err" : "insertDocument :: caused by :: 16755 Can't extract geo keys from object, malformed geometry?: { _id: ObjectId('53a89dc6a0042baf54050037'), id: 24837452, version: \"64\", changeset: \"13731788\", uid

MongoDB 2dsphere index fails (malformed geometry?)

前提是你 提交于 2019-12-10 13:28:26
问题 I'm currently trying to build an 2dsphere index, but the creation seems to fail. The document on which the index creation fails is valid geojson (according to geojsonlint). Also as far as I can see it obeys the MongoDB "Polygon" rules. I would appreciate any help, since I can't figure out why the index creation seems to fail. Thanks in advance! db.poly.ensureIndex( { loc: "2dsphere" } ) { "createdCollectionAutomatically" : false, "numIndexesBefore" : 1, "ok" : 0, "errmsg" : "Can't extract geo

MongoDB Error Code 16755 - Can't extract geo keys & duplicate vertices

爷,独闯天下 提交于 2019-12-06 03:10:44
问题 When I try to create an index on geometry db.polygons.createIndex({"geometry":"2dsphere"}) , it stops at a certain polygon with the error code 16755. It says it Can't extract geo keys and Duplicate vertices: 18 and 20 . So upon further inspection, it seems like this happens when 2 nodes in a polygon are close together, or even duplicates. I then go manually remove this node in QGIS and re-try the process, only to find there's another polygon with the same issue. How can I fix this issue

MongoDB Error Code 16755 - Can't extract geo keys & duplicate vertices

僤鯓⒐⒋嵵緔 提交于 2019-12-04 08:24:00
When I try to create an index on geometry db.polygons.createIndex({"geometry":"2dsphere"}) , it stops at a certain polygon with the error code 16755. It says it Can't extract geo keys and Duplicate vertices: 18 and 20 . So upon further inspection, it seems like this happens when 2 nodes in a polygon are close together, or even duplicates. I then go manually remove this node in QGIS and re-try the process, only to find there's another polygon with the same issue. How can I fix this issue without having to repeat the entire process of fixing polygon > uploading to MongoDB > creating index? Is

MongoDB $geoNear aggregation pipeline (using query option and using $match pipeline operation) giving different no of results

匆匆过客 提交于 2019-11-30 16:03:14
问题 I am using a $geoNear as the first step in the aggregation framework. I need to filter out the results based on "tag" field and it works fine but I see there are 2 ways both giving different results. Sample MongoDB Document { "position": [ 40.80143, -73.96095 ], "tag": "pizza" } I have added 2dsphere index to the "position" key db.restaurants.createIndex( { 'position' : "2dsphere" } ) Query 1 uses $match aggregration pipeline operation to filter out the results based on "tag" key db