We currently have big problems with operation $nearc MongoDB 3.2.9.
The problem is that when creating the cursor there is an infinite load - up to the timeout. This problem arises only when we do not use $maxDistance- which in our case is important not to use.
This is our collection:
Places
About 2,000,000 documents with GeoJSON geometry, which is also indexed.
In addition to geometry, there is another index called the "category".
In our special case, our request is as follows:
Locations.find({
category: 'ABC',
geometry: {
'$near': {
$geometry: {
type: "Point" ,
coordinates: [ 13.357315063476564, 52.53167855932515 ]
}
}
}
}, {
limit: 10
});
This request will result in a timeout .
, $maxDistance, ( $maxDistance ). a $maxDistance , 1 . , , , - .
:
, LESS, . 8 . 10 , .
:
Locations.find({
category: 'ABC',
geometry: {
'$near': {
$geometry: {
type: "Point" ,
coordinates: [ 13.357315063476564, 52.53167855932515 ]
}
}
}
}, {
limit: 10
});
Locations.find({
category: 'ABC',
geometry: {
'$near': {
$geometry: {
type: "Point" ,
coordinates: [ 13.357315063476564, 52.53167855932515 ]
}
},
'$maxDistance': 5000
}
}, {
limit: 10
});
Locations.find({
category: 'DEF',
geometry: {
'$near': {
$geometry: {
type: "Point" ,
coordinates: [ 13.357315063476564, 52.53167855932515 ]
}
}
}
}, {
limit: 10
});
MongoDB 3.2.9
, MongoDB nodeJS. RoboMongo, : -!