Based on the guide: https://guide.meteor.com/methods.html#consistent-id-generation 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 https://guide.meteor.com/methods.html#consistent-id-generation – 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!
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.
Yeah this feature was added in 0.9 but almost not advertised at all.
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…
Most probably I’ve read some outdated tutorials then. Sorry for misguiding.