This is so i can obtain changes to the database from a certain point in time (i.e. when i manually copy the database). I’m using $gt changestream._id to gather changes.
Hi Kevin,
There are two ways that you could do without trying to peek into the oplog directly.
You can specify resumeAfter
option on collection.watch(). This will direct watch()
to attempt resuming notifications starting after the operation specified in the resume token. The option accepts value returned by change stream event in _id
field.
Alternatively you can specify startAtOperationTime
option on collection.watch() (new in MongoDB v4.0). The option accepts a timestamp value returned by change stream event in clusterTime
field.
For both of the solutions above, you need to collect the last change stream event known before performing the manual database copy.
Regards,
Wan.