Operational Defect Database

BugZero found this defect 192 days ago.

MongoDB | 2495905

Upsert from $nor predicate generates different fields

Last update date:

3/11/2024

Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:

No fixed releases provided.

Description:

Info

I ran into this while adding upsert support to the update fuzzer during skunkworks (TIG-4521). This appears to be caused by SERVER-81630 - I noticed different behavior after it than before it. Before the change, an upsert with a query like this: {$nor: [{$or: [{x: 1}, {y: 2}]}, {x: {$ne: 3}}]} would insert an empty document (that is, empty aside from _id). After the change, it inserts a document with _id and a field from the $nor predicate (x: 3). This predicate with a $ne and $or nested in a $nor was the simplest one I could find to trigger the differing behavior.

Top User Comments


Steps to Reproduce

MongoDB Enterprise > db.runCommand({ update: "coll", updates: [{ multi: true, upsert: true, q: { $nor: [{ $or: [ { "x": 1 } , { "y": 2 } ] }, { "x": { $ne: 3 } }] }, u: [ { "$unset" : "z" } ] }] }) { "n" : 1, "upserted" : [ { "index": 0, "_id": ObjectId("654d421587d21e4fb0f54e2e") } ], "nModified" : 0, "ok" : 1 } MongoDB Enterprise > db.coll.find() { "_id" : ObjectId("654d421587d21e4fb0f54e2e"), "x" : 3 }

Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

Needs Scheduling

Learn More

Search:

...