Enable change streams on Amazon DocumentDB

Amazon DocumentDB change streams provides a time-ordered sequence of change events that occur within your cluster’s collections and databases. You can poll change streams on individual collections and read change events (INSERTS, UPDATES, and DELETES) as they occur. In this lab you will use change streams to stream change events from your Amazon DocumentDB cluster to an Amazon S3 bucket. Use the mongo shell to log into the database:

mongo --ssl --host $docdbEndpoint:27017 --sslCAFile rds-combined-ca-bundle.pem --username $docdbUser --password $docdbPass

Enable the change stream on your cluster using the command below:

db.adminCommand({modifyChangeStreams: 1, database: "", collection: "", enable: true});

You should get the following response:

{ “ok” : 1 }

Log out from the mongo shell:

quit()