Show
Create a new client, run insert and remove and inspect the contents of the oplog:
var dbWithSession = new Mongo( 'localhost:20000' ).startSession({retryWrites: true }).getDatabase( 'TestDB' );
For inserts:
dbWithSession.insert({_id: 1});
The oplog contains lsid/txnNumber information:
{
"ts" : Timestamp(1508263733, 1),
"t" : NumberLong(1),
"h" : NumberLong("5813089571967450467"),
"v" : 2,
"op" : "i",
"ns" : "TestDB.TestColl",
"ui" : UUID("e551162e-21a0-4c90-82e5-9e6ea239ef1f"),
"wall" : ISODate("2017-10-17T18:08:53.938Z"),
"lsid" : {
"id" : UUID("62f09f8b-5f90-4a5c-9c39-708923793815"),
"uid" : BinData(0,"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=")
},
"txnNumber" : NumberLong(0),
"stmtId" : 0,
"prevOpTime" : {
"ts" : Timestamp(0, 0),
"t" : NumberLong(-1)
},
"o" : {
"_id" : 1
}
}
For removes:
dbWithSession.TestColl.remove({_id: 0});
It doesn't:
{
"ts" : Timestamp(1508263783, 1),
"t" : NumberLong(1),
"h" : NumberLong("6684227120267171736"),
"v" : 2,
"op" : "d",
"ns" : "TestDB.TestColl",
"ui" : UUID("e551162e-21a0-4c90-82e5-9e6ea239ef1f"),
"wall" : ISODate("2017-10-17T18:09:43.947Z"),
"o" : {
"_id" : 1
}
}