Currently, changeStreams supports watching namespace by 3 granularities: single collection, single db, all dbs. If users want to monitor several dbs, we must watch all dbs and then use the filter stage or some outer method to only pass the namespace we want. However, this method is not efficient because there is so much unwanted data pass between mongos, mongod, and even client if we use the outer method to filter.
In our multi-tenant severless environment, using "watch all dbs" will consume a lot of resources: db1, db2 belongs to user1; db3, db4 belongs to user2. So when we want to migrate user1 to another instance, we must start changeStreams to watch all dbs(db1, db2).
- related to
-
SERVER-48694 Push down user-defined stages in a change stream pipeline where possible
- Closed