|
Note: as it was disccussed with rathi.gnanasekaran, "Changestream Example 4" from this ticket was combined with "Changestream Example 4" from the ticket https://jira.mongodb.org/browse/CSHARP-2148 .
The final query:
const pipeline = [
|
{ $match: { $or : [{ 'fullDocument.username': 'alice' }, { 'operationType' : 'delete' }] } },
|
{ $addFields: { newField: 'this is an added field!' } }
|
];
|
const collection = db.collection('inventory');
|
const changeStream = collection.watch(pipeline);
|
const next = await changeStream.next();
|
cc: rstam
|