Search code examples
meteorddp

Message order in Meteor DDP


Suppose the client goes offline. During that time, the following code executes:

Messages.remove(oldMessage._id)
Messages.insert(newMessage)

When client goes online, is it guaranteed that remove will execute first, insert will execute second?

In other words, is it guaranteed that only one of those messages will be present in database at any time?


Solution

  • Remove will execute first and then the insert. Meteor queue all the DDP messages and execute in order when it connected again.