You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 1, 2025. It is now read-only.
I'm having a problem with the custom near query again, using v4.4.1
If I specify a name for the query like so:
custom: {…
near: 'loc'}
It throws an error from Mongo:
error processing query: ns=echoesfullstack-dev.collections limit=10Tree: $and pub_status == \"public\"
GEONEAR field=(query, point) => {
const pointArr = point.split(',').map(p => parseFloat(p, 10));
if (pointArr.length >= 2) {
if (!isNaN(pointArr.reduce((a, b) => a + b))) {
const max = pointArr[2];
const min = pointArr[3];
query[field] = {
$near: {
$geometry: {
type: 'Point',
coordinates: pointArr.splice(0, 2),
},
},
};
if (!isNaN(max)) {
query[field].$near.$maxDistance = max;
if (!isNaN(min)) {
query[field].$near.$minDistance = min;
}
}
}
}
} maxdist=1.79769e+308 isNearSphere=0
Sort: {}
Proj: {}
planner returned error: unable to find index for $geoNear query
It seems to be returning the entire function as a query. Is that expected behaviour?
I manually overrode the query with :
if(query.near){letpointArr=req.query.near.split(',').map(p=>parseFloat(p,10));letn={$near: {$geometry: {type: 'Point',coordinates: pointArr.splice(0,2),}}};// maybe we have $maxDistanceif(pointArr.length)n.$near.$maxDistance=parseFloat(pointArr.shift());deletequery.nearquery.loc=n;}