Details
-
Improvement
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
4.2.0-rc2
-
None
-
None
-
None
-
Query Execution
-
Fully Compatible
Description
Normal update operation in shows up in oplog (changestream) as operationType update, while update with aggregation pipeline shows up in oplog (changestream) as operationType replace.
Example:
db.test.update({a:1}, {$set:{b:"foo"}})
|
Output:
{ '_id': { '_data': '...'},
|
'clusterTime': Timestamp(1562633420, 1),
|
'documentKey': {'_id': ObjectId('5d1ede84705cbd6a35d69fcf')},
|
'ns': {'coll': 'test', 'db': 'test'},
|
'operationType': 'update',
|
'updateDescription': {'removedFields': [], 'updatedFields': {'b': 'foo'}}}
|
While update with aggregation:
db.test.update({a:1}, [{$set:{b:"bar"}}])
|
Output:
{ '_id': { '_data': '...'},
|
'clusterTime': Timestamp(1562633424, 1),
|
'documentKey': {'_id': ObjectId('5d1ede84705cbd6a35d69fcf')},
|
'fullDocument': { '_id': ObjectId('5d1ede84705cbd6a35d69fcf'),
|
'a': 1.0,
|
'b': 'bar'},
|
'ns': {'coll': 'test', 'db': 'test'},
|
'operationType': 'replace'}
|
Would this behaviour likely to be changed in the future ?