Collections update order

Hi all,

If I update collection A and B sequentially on the client without awaiting method callbacks like this:“collectionA.update”, _id1, doc1);“collectionB.update”, _id2, doc2);


  1. WIll this update order be maintained on the server?

  2. Regardless of answer 1, will all subscribed clients their update order always match the server’s collections update order?

Thanks for responding.

  1. No. To make sure it runs in order, you need to run the second method call in callback of the first method call:"collectionA.update", { id: _id1, doc: doc1 }, (error, result) => {"collectionB.update", { id: _id2, doc: doc2 });
  1. No. It usually matches but not always.

Thanks for the quick response!

How can I solve 2. then? If collection B updates on any client may only be interpreted after collection A updates happened first, is there a way to achieve this?

You can subscribe to the collection B, once data changed, use method to load data from collection A. There could be other solutions.
You can use method to fetch data and insert data to local collection manually.

Pretty sure that (1) is true. Execution order is preserved for client initiated Meteor methods in general unless you call this.unblock(), and client initiated collection updates are just meteor methods. No callbacks needed.

I think that (2) is also true, but I wouldn’t recommend relying on that.

I could be wrong. I forgot the unblock function on the method. I call this all the time to increase SSR performance.