-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 4.2.20
-
Component/s: Query Execution
-
Fully Compatible
-
ALL
-
QE 2022-08-08
I have a collection with an index declared as: ({siteId: 1, startDate:1, endDate: 1}, {collation: {"locale": "en"}}).
Some aggregate queries generate database errors, such as:
{ "aggregate" : "MyColl", "pipeline" : [{ "$match" : { "siteId": { "$oid": "5bfeb296db127e1168efbf13" }, "$or" : [{ "startDate" : null }, { "startDate" : { "$gte" : "2022-01-01" } }] } }, { "$sort" : { "startDate" : 1, "endDate" : 1 } }], "collation" : { "locale" : "en" } }
The database responds:
{ "ok" : 0.0, "errmsg" : "assertion src/mongo/bson/bsonobjbuilder.h:195", "code" : 8, "codeName" : "UnknownError" }
It only occurs when there are matches where the startDate field is null (undefined).