parse.com - withinkilometers geoquery in parse cloud fails with MongoDB error -


i'm trying closest parse object within 20 kms of location.

  var testpoint = new parse.geopoint({latitude: fromlatlng.lat, longitude: fromlatlng.lng});   var bkcity = parse.object.extend("bkcity");   var cityquery = new parse.query(bkcity);   //throws mongo error   cityquery.withinkilometers("location", testpoint, 20);   cityquery.find({   ... 

however query fails with:

�[31merror�[39m: uncaught internal server error. { [mongoerror: can't canonicalize query: badvalue geo near accepts 1 argument when querying geojson point. field found: $maxdistance: 0.003139224611520954]       name: 'mongoerror',       message: 'can\'t canonicalize query: badvalue geo near accepts 1 argument when querying geojson point. field found: $maxdistance: 0.003139224611520954',       '$err': 'can\'t canonicalize query: badvalue geo near accepts 1 argument when querying geojson point. field found: $maxdistance: 0.003139224611520954',       code: 17287 } mongoerror: can't canonicalize query: badvalue geo near accepts 1 argument when querying geojson point. field found: $maxdistance: 0.003139224611520954         @ function.mongoerror.create (d:\home\site\wwwroot\node_modules\mongodb-core\lib\error.js:31:11)         @ querycallback (d:\home\site\wwwroot\node_modules\mongodb-core\lib\cursor.js:182:34)         @ callbacks.emit (d:\home\site\wwwroot\node_modules\mongodb-core\lib\topologies\server.js:119:3)         @ null.messagehandler (d:\home\site\wwwroot\node_modules\mongodb-core\lib\topologies\server.js:295:23)         @ socket.<anonymous> (d:\home\site\wwwroot\node_modules\mongodb-core\lib\connection\connection.js:285:22)         @ emitone (events.js:77:13)         @ socket.emit (events.js:169:7)         @ readableaddchunk (_stream_readable.js:146:16)         @ socket.readable.push (_stream_readable.js:110:10)         @ tcp.onread (net.js:523:20) 

query works on javascript, .near() query works not withinkilometers query.

is parse-server bug or mlab issue or silly mistake on part?

sorry this. turns out messed converting javascript string float when setting geopoint.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -