When using withinMiles inside a query, the following error comes.
{"code":141,"error":"{\"code\":1,\"message\":\"internal error\"}"}
MongoDB 3.0.0 , 3.0.8 , 3.0.9 , 3.0.11 were all tried but the same error occurs.
Without using the location query, it works fine.
Obviously the same issue exist when using withinMiles in parseCloud also.
Can you enable verbose logging in your server and post some logs?
Drew, we're seeing the following on our Mongo logs. We're still on the Hosted Parse.com server and have connected to a self-hosted MogoDB instance on Digital Ocean.
2016-04-24T15:05:50.805-0400 I QUERY [conn20] assertion 17007 Unable to execute query: error processing query: ns=twazer-test.Product limit=20 skip=0
Tree: $and
isSold == false
state == 1.0
price $lte 1000000.0
price $gte 0.0
_rperm $in [ null "*" "eI6TzVuEON" ]
$not
_p_seller == "_User$eI6TzVuEON"
GEONEAR field=location maxdist=0.0126301 isNearSphere=1
Sort: { rank: 1, _created_at: -1 }
Proj: {}
planner returned error: unable to find index for $geoNear query ns:twa
2016-04-24T15:05:50.805-0400 I QUERY [conn20] ntoskip:0 ntoreturn:20
The relevant line in Android (and the equivalent in iOS) is being passed to the server:
productParseQuery.whereWithinMiles("location", geoPointFromLocation(mCurrentLocation), currentSearchRadius);
Parse Server has code that auto-detects missing geo indexes and adds them, so seeing that error doesn't necessarily indicate a problem. There could be an issue building the index though. Can you try checking what indexes you have on that class?
MongoDB error
assertion 17007 Unable to execute query: error processing query: ns=twazer-test.Product limit=10 skip=0
Tree: $and
isSold == false
state == 1.0
price $lt 6000.0
price $gt 0.0
_rperm $in [ null "*" ]
$not
_p_seller == "_User$bUzh1YKKUp"
GEONEAR field=location maxdist=0.00252602 isNearSphere=1
Sort: { _id: -1 }
Proj: {}
planner returned error: unable to find index for $geoNear query ns:twazer-test.Product query:{ $query: { isSold: false, state: 1.0, _p_seller: { $ne: "_User$bUzh1YKKUp" }, location: { $nearSphere: [ 28.99432373085983, 41.06008860570056 ], $maxDistance: 0.002526017985248055 }, price: { $gt: 0.0, $lt: 6000.0 }, _rperm: { $in: [ null, "*" ] } }, $orderby: { _id: -1 }, $maxScan: 500000, $maxTimeMS: 29000, $comment: "queryhash:60fbe84d04dbe87266ecd0a63ec3a49c" }
2016-04-26T07:57:30.690-0400 I QUERY [conn18] ntoskip:0 ntoreturn:10
Drew,
We're a little new to managing NoSQL databases so please bear with us. We get the following when running getIndexes on the relevant class.
db.Product.getIndexes()
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"name" : "_id_",
"ns" : "twazer-test.Product"
}
]
However, as shown in Krishna's output above, there are several indices that exist (and are shown when we run find() on the class) in the Product class, including "location" which was a ParseGeoPoint before. Does this help?
Thanks
-Amir
Are you using MongoDB in replicaset or cluster mode? It's possible that the index exists on only some of the machines. Can you check that, and try creating the indexes manually? Also, for internal server error, verbose logs will likely include helpful info for debugging.
I'm seeing the same error for a geoquery - new error since migration to MLab. Checking MLab now for the index - I'm running in cluster mode.
We have to create index for our database column for mongoDB to support geoQuerry.
db.prod.createIndex({ "location": "2d" })
Where prod is my collection name and location is name of column which stores geo location (GeoPoint)
Thanks
@kevflynn - did you figure this out on MLab? did you just manually create the new index or was it something else? I'm about to migrate and we have a withinMiles query and are going with MLab too. thanks.
I manually created index for required columns.
Most helpful comment
I'm seeing the same error for a geoquery - new error since migration to MLab. Checking MLab now for the index - I'm running in cluster mode.