mongo version: 4.4.5
dms_admin> watch_cursor = db.getMongo().watch()
ChangeStreamCursor on mongodb://<credentials>@ip:port/?directConnection=true&appName=mongosh+1.6.2
dms_admin> watch_cursor.tryNext();
{
_id: {
_data: '8263EB034E000000032B022C0100296E5A1004D775448B6F1E4A91A72F8304F5786F03463C5F6964003C34653738316138632D643634632D343130302D623831612D386364363463373130306137000004'
},
operationType: 'replace',
clusterTime: Timestamp({ t: 1676346190, i: 3 }),
fullDocument: {
xxxxx: xxxxx
},
ns: { db: 'db', coll: 'coll' },
documentKey: { _id: '4e781a8c-d64c-4100-b81a-8cd64c7100a7' }
}
dms_admin> watchCursor = db.watch([], {"startAfter": {"_data": "8263EB034E000000032B022C0100296E5A1004D775448B6F1E4A91A72F8304F5786F03463C5F6964003C34653738316138632D643634632D343130302D623831612D386364363463373130306137000004"}});
ChangeStreamCursor on dms_admin
[direct: mongos] dms_admin> watchCursor.tryNext();
null
[direct: mongos] dms_admin> watchCursor.tryNext();
null
[direct: mongos] dms_admin> watchCursor = db.watch([], {"resumeAfter": {"_data": "8263EB034E000000032B022C0100296E5A1004D775448B6F1E4A91A72F8304F5786F03463C5F6964003C34653738316138632D643634632D343130302D623831612D386364363463373130306137000004"}});
ChangeStreamCursor on dms_admin
[direct: mongos] dms_admin> watchCursor.tryNext();
null
[direct: mongos] dms_admin> watchCursor.tryNext();
null
// before execute tryNext, modify some data at another session.
[direct: mongos] dms_admin> watchCursor.tryNext();
null
[direct: mongos] dms_admin> watchCursor.tryNext();
MongoServerError: cannot resume stream; the resume token was not found. {_data: "8263EB0393000000032B022C0100296E5A10042A041639D2024311906742C001F1320B463C5F6964003C4F35313233353933000004"}
[direct: mongos] dms_admin>
anyone can help?