Accounts with _id type as ObjectID


Any one has been successfull using user._id as an ObjectID instead of a string?
Object is the default mongo type but Meteor Accounts continues on using String.

We have tried the onCreateUser function but then the user is not created.

Accounts.onCreateUser(function(options, user) {
  user._id = new Mongo.ObjectID();
  return user;

Thanks in advance

I believe the official stance is “get stuffed”.

Should be able to overwrite the default behaviour by using a local version of accounts-base.
To do this, download the /packages/accounts-base folder from Meteor’s github and place it in your /packages/ directory.
Then you can edit accounts_common.js line 23-26 to set the id generation to Mongo with the option idGeneration : 'MONGO'

There’s likely to be a whole lot of errors in places that assume userIds are strings and you’ll need to go around fixing them