17. const changeStream =
db.collection('train').watch();
c h a n g e S t r e a m . o n ( ' c h a n g e ' , ( c h a n g e ) = > { c o n s o l e . l o g ( c h a n g e ) } ) ;
Added in 3.6
Improved in 4.0
{
"_id" : (resumeToken),
"operationType" : "insert",
"ns" : { "db" : "test", "coll" : "train" },
"documentKey" : {
"_id" : 123
},
"fullDocument" : {
"_id" : 123,
"text": "hello"
},
}
26. Change Streams Utilize the Power of the
Aggregation Framework
$match $project $addFields $replaceRoot $redact
var changeStream = coll.watch([{ $match: {operationType: {$in: ['delete', 'replace']}}}]);
27. 1. Collection Access Controls
2. Defined API
3. Enable Scaling
4. Total Ordering
5. Durable
6. Resumable
7. Power of Aggregation