-
Type: Bug
-
Resolution: Gone away
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.2.30
-
Component/s: MongoDB 3.4
-
Environment:Mac OS 12.10.6
-
Empty show more show less
Note: I'm filing on behalf on Mixmax, which has an enterprise support contract.
The following bulk update operation:
bulk.find({
_id: userId,
stages: {
$elemMatch: {
id: stageId
}
}
})
.update({
$set: {
'stages.$.scheduledAt': date
}
});
produces the WriteResult
{ writeErrors: [], writeConcernErrors: [], nInserted: 0, nUpserted: 99, nMatched: 0, nModified: 0, nRemoved: 0, upserted: [], ok: 1 }
However, the collection in question contains the same number of records before and after the operation runs. The records are successfully modified by the operation, but it does not appear that an upsert is occuring - nor is one desired. (Note the absence of a .upsert() call on the operation - should upserting even be possible?) Furthermore, the (undocumented?) "upserted" array on the writeresult object is empty, which would also seem to indicate no upserting occurred.
Why is nUpserted being used instead of nModified?