Complete the code to query the oplog collection in MongoDB.
db.local.oplog.rs.find([1])The oplog query requires a filter object. An empty filter {} returns all oplog entries.
Complete the code to find oplog entries for insert operations only.
db.local.oplog.rs.find({op: [1])The op field in the oplog indicates the operation type. 'i' stands for insert.
Fix the error in the code to query oplog entries after a specific timestamp.
db.local.oplog.rs.find({ts: {$gt: [1])ISODate or Date which do not match the oplog timestamp type.ObjectId which is unrelated here.The oplog ts field uses MongoDB Timestamp type, so the filter must use a Timestamp object.
Fill both blanks to create a query that finds oplog entries for updates on a specific namespace.
db.local.oplog.rs.find({op: [1], ns: [2])The op value 'u' filters updates, and ns specifies the namespace like 'test.collection'.
Fill all three blanks to create a query that finds delete oplog entries on 'logs.events' namespace after a given timestamp.
db.local.oplog.rs.find({op: [1], ns: [2], ts: {$gt: [3])Timestamp.Use 'd' for delete operations, specify the namespace as 'logs.events', and use a Timestamp object for the timestamp filter.