-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Query Integration
-
Fully Compatible
-
ALL
-
v8.0
-
200
You are allowed to pass legacy coordinate pairs as either an array (e.g., [1,0]) or as an embedded document (e.g., {x: 1, y: 0}). According to the docs, for the embedded document approach you can provide any field names, and the fields will be treated as longitude and latitude in respective order. That means you could use $geometry and $minDistance as field names to specify the coordinates, like
db.geo.find({loc: {$nearSphere: {$geometry: 128, $minDistance: 0.1}}})
This query will act equivalent to
db.geo.find({loc: {$nearSphere: [128, 0.1]}})
These queries execute the same, but the first one fails to serialize when queryStats is enabled since it expected any $geometry field to have a sub-object.