Latency compensation - different insert id's

Based on the guide: we expect the id of an inserted doc to be the same in a method call on client and server. We are not getting that. We used the same function on client and server and still different id’s. Is there anything special we have to do? We are not affecting DDP in any way.

Remember that works only with Validated Methods, not normal methods.

Thanks @gusto, this is not apparent in the appropriate section – it only talks about Methods (not validated methods).

@sashko, sorry to bug you. Can you weigh in? I feel it’s not clear.

It should work regardless - perhaps there is something weird in your code?


Yup, you nailed it … was using the GroundDB collection in the client simulation method. Once we used the original mongo collection in the client method it worked as planned!

Thanks @sashko!


Just to make sure. Am I right that around Meteor 1.1.-1.2 the ID generated was different? Or do I just remember wrong?

As far as I remember it’s always been like this.

1 Like

Yeah this feature was added in 0.9 but almost not advertised at all.

1 Like

Ah, that explains it. Just about when I started in earnest with Meteor.

Just found it in the changelog - 0.8.1:

…Calling insert inside a method body now generates the same ID on the client (inside the method stub) and on the server. A sequence of inserts also generates the same sequence of IDs…

1 Like

Most probably I’ve read some outdated tutorials then. Sorry for misguiding.

1 Like