-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
ALL
-
Query 2021-01-11
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Consider the following validator expression:
{ coordinates: {$geoWithin: { $centerSphere: [ [ -79.9081268, 9.3547792 ], 0.02523 ] } } }
Inserting the document
{coordinates: [ -72.5419922, 18.2312794 ]}
produces the following error.
WriteResult({
"nInserted": 0,
"writeError": {
"code": 121,
"errmsg": "Document failed validation",
"errInfo": {
"failingDocumentId": ObjectId("5fd6918a42c10f01eeca6658"),
"details": {
"operatorName": "$geoWithin",
"specifiedAs": {
"coordinates": {
"$geoWithin": {
"$centerSphere": [
[
-79.9081268,
9.3547792
],
0.002523
]
}
}
},
"reason": "type did not match",
"consideredType": "double",
"expectedTypes": [
"array",
"object"
],
"consideredValues": [
-72.5419922,
18.2312794
]
}
}
}
The detailed error incorrectly reports a type mismatch error, when instead it should report the following error string.
This bug reflects an issue with type checking when generating document validator errors.