Details
-
Bug
-
Resolution: Works as Designed
-
Major - P3
-
None
-
None
-
None
Description
Recent changes in the Node.js driver to ensure the CRUD spec requirement that all update documents MUST contain atomic operators has exposed a limitation in the spec previously supported in the driver: we provide no spec-compliant way to upsert an empty document. The specific language indicates:
The update family of operations require that the update document parameter MUST have only atomic modifiers.
However, the following query results in a server error:
await db.collection('Test').bulkWrite([{
|
updateOne: { filter: { name: 'test' }, update: { $set: {} }, upsert: true }
|
}]);
|
|
|
// error: '$set' is empty. You must specify a field like so: {$set: {<field>: ...}}
|
I suggest that we loosen the language for the requirement of atomic operators to consider whether upsert: true has been provided.