Overriding meteor id generation


#1

The docs say one can use the ‘String’ default that uses the Random.id(), or the Mongo default ObjectID()

I want to use my own id generator, because it needs to be unified with other services that use this ID type.

How can I override the standard id generation without too much of a hack?

Thanks for help.


#2

Just provide an _id of your own when doing an insert() or upsert():

MyCollection.insert((_id:"whatever you like", name:"bob", age:"22"});

#3

If you’re using IDs from other services, upsert might be of use for you.


#4

Great, thanks…
That works for me.