-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: 5.0.3
-
Component/s: None
-
None
-
Query Execution
-
ALL
-
-
QE 2024-07-22, QE 2024-08-05, QE 2024-08-19, QE 2024-09-02
Using the $jsonSchema operator to find documents that don't match a schema doesn't appear to work correctly when dealing with documents with potentially empty keys.
db.foo.aggregate([{ "$match": { "$nor": [ { "$jsonSchema": { "bsonType": "object", "properties": { "a": { "bsonType": "int" }, "b": { "bsonType": "string" }, "c": { "bsonType": "object", "properties": { "": { "bsonType": "int" }, "d": { "bsonType": "int" } }, "required": ["", "d"], "additionalProperties": false }, "_id": { "bsonType": "objectId" } }, "required": ["_id", "a", "b", "c"], "additionalProperties": false } }] } }]) [ { _id: ObjectId('66958a96ac4c566990c31464'), a: 1, b: '2', c: { '': 3, d: 4 } } ]