Mongodb Watch for Sharded DB

Hey @gopinath_pappu,

Welcome to the MongoDB University forums :sparkles:

You need to make your Mongo database a replica set with one node only in order to read the oplog!

So you need to start your mongod with the --replSet option or edit the mongod.conf to include a replication section. i.e:

replication:
  replSetName: my-replica-set

Then start or restart the server with these changes, and then connect with the mongo shell and enter:

rs.initiate()

Now you can write code that relies on an Oplog to be present.

For more info please refer to the official documentation: Convert a Standalone to a Replica Set

In case you have any doubts, please feel free to reach out to us!

Thanks,
Kushagra