as reported in #mongosh on Slack:
replset [primary] test> var changeStream = db.watch() ChangeStreamCursor on test replset [primary] test> db.foo.insert({name:"John"}) DeprecationWarning: Collection.insert() is deprecated. Use insertOne, insertMany, or bulkWrite. { acknowledged: true, insertedIds: { '0': ObjectId("60ec1c6464ec76b1492fae72") } } replset [primary] test> changeStream.next() Warning: If there are no documents in the batch, next will block. Use tryNext if you want to check if there are any documents without waiting.
replset:PRIMARY> var changeStream = db.watch() replset:PRIMARY> db.foo.insert({name: "foo"}) WriteResult({ "nInserted" : 1 }) replset:PRIMARY> changeStream.next() { "_id" : { "_data" : "8260EC1C9E000000012B022C0100296E5A1004627EABB2BF0E4DDB8D434E0CB526A8B046645F6964006460EC1C9E42E74AB99614C8460004" }, "operationType" : "insert", "clusterTime" : Timestamp(1626086558, 1), "fullDocument" : { "_id" : ObjectId("60ec1c9e42e74ab99614c846"), "name" : "foo" }, "ns" : { "db" : "test", "coll" : "foo" }, "documentKey" : { "_id" : ObjectId("60ec1c9e42e74ab99614c846") } }
- related to
-
MONGOSH-888 Shell exits if interrupted during changeStreamCursor.next()
- Closed