The-Ultimate-Guide-to-TypeScript-With-Mongoose icon indicating copy to clipboard operation
The-Ultimate-Guide-to-TypeScript-With-Mongoose copied to clipboard

Please add the watch functionality too

Open kasir-barati opened this issue 4 years ago • 0 comments

Hi, you miss the watch/change stream functionality. please add it. When I do this:

const userChangeStream = UserModel.watch();

userChangeStream.on('change', async (doc) => {
     if (doc.operationType === 'update') {
          console.log(doc.documentKey._id.toHexString()); // Object is of type 'unknown'.
     }
}

What can I do?

kasir-barati avatar Aug 14 '21 13:08 kasir-barati