When you’re not sure about these stuff, it’s best to try them out. You can also use meteorpad.com for simple demos. (I made one for you here).
Meteor uses some internal methods when user does something with a collection on the client side. These are named like
/my-docs/remove, … This is where Meteor’s allow/deny rules are checked.
I’ll try to explain what happens when the
Meteor.call(...) line is executed on the client.
updateDoc method handler is run on the client. This is called a simulation.
MyDocs.insert(doc) is called on the client, Meteor usually calls
/my-docs/insert but this time as we’re already inside a simulation, it will just return. So the document is not inserted at this time. So we don’t get latency compensation.
- Then the
updateDoc method handler is run on the server which will successfully insert the document and send an
updated message to the client.
- The document will be added to client side mini mongo collection and gets rendered on the client.
You can use Kadira Debug to learn what’s happening inside Meteor. I’ve attached 2 screenshots. First one is taken after running
MyDocs.insert on client. And second one is taken after running it on server with a kinda not-working latency compensation (as in your code).