Overriding meteor id generation

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.

1 Like

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

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

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

Great, thanks…
That works for me.