Hi, I am using the pymongo client to access MongoDB for a web app. I want to replicate all changes on a collection (with some changes) to another collection using change streams. I have successfully written the required code. Lets say I have the following code:

cursor = db['db-ai']['items'].watch() document = next(cursor) print(document) while True: resume_token = cursor.resume_token cursor = db['db-ai']['items'].watch(resume_after=resume_token) document = next(cursor) print(document)

What is the best way to run this code? I have very low traffic for the database.