I suspect if the course material is partly outdated or simply wrong given that the lecture 2 about
$geoNear stage is not compatible with MongoDB documentation
Here’s a screenshot from lecture describing the
- First Issue:
[00:48 - 00:53] One last thing, $geoNear requires that the collection we’re performing our aggregations on to have one and only one geoindex.
I don’t think the above statement is true, given the fact that
key field can be specified in for
$geoNear options, which specifies the geospatial indexed field to use when calculating the distance.
- Second Issue:
[01:07] Required arguments are near, distanceField, and spherical.
$geoNear definition in the documentation clearly shows and states that the only required fields are
distanceField, and not
- Third Issue:
numfields are removed as stated in the docs, but are used in the lecture.
Could you clarify the above states issues?