Ordering guarantees for Change Streams

38 views
Skip to first unread message

klaussner

unread,
Nov 16, 2017, 5:00:46 PM11/16/17
to mongodb-user
The documentation states that Change Streams provide a total ordering across shards (https://docs.mongodb.com/master/administration/change-streams-production-recommendations/#sharded-clusters). Is there a similar guarantee for the order of changes made to different collections (in a non-sharded replica set)? For example, if I update a document in collection A and then a document in collection B, are the change events guaranteed to arrive in that order at all clients watching these two collections?

Aly Cabral

unread,
Nov 17, 2017, 3:43:18 PM11/17/17
to mongodb-user
Hi klaussner,

While the global logical clock internally does provide a total ordering across collections, change streams can be only opened against ONE collection in MongoDB 3.6. 

Change stream A ---> Collection A
Change stream B ---> Collection B

The change streams will not be aware of one another and do not coordinate amongst themselves so this guarantee is not provided across collections. We are considering allowing clients to open change streams against databases and this would provide a total ordering of all changes across the collections within the database. 

Aly Cabral

@aly_cabral
Reply all
Reply to author
Forward
0 new messages