Hey i am making use of mongodb npm package: “mongodb”: “^4.1.3” – i am making use of documentdb and not mongo db directly.
Documentdb v4 claims to introduce the Change Streams functionality with startAtOperationTime functionality.
I am trying to make use of startAtOperationTime for the change stream option, but it i isn’t working.
const shadowCollection = await DOCUMENT_DB.collection(COLLECTION_NAME, {
readPreference: 'primary'
});
const changeStream = shadowCollection.watch([], {
startAtOperationTime:
Timestamp.fromString(new Date(1646137220562).toString()) // if we do not pass this option then it works fine
});
await changeStream.hasNext() // this line throws the error
Error is: MongoError: modifyChangeStreams has not been run for this collection/database/cluster
And i have enabled the change streams on this particular database and collection.
Anything that i am doing wrong? Or some other suggestions