We ran into a peculiar issue while working with Meteor. We had two separate Meteor application that both needed to access the same MongoDB since they shared many of the same collections, but they needed to have their own users collections. This was a problem, since the users collection always had the default name of “users” and there was no official way to customize that collection name.
After digging around the source code, we came up with the following workaround. Putting this in a .js file in our /lib folder in our Meteor project did the trick:
// let meteor uses 'custom_users' collection as 'users' collection
Accounts.users = new Mongo.Collection("custom_users", {
_preventAutopublish: true
});
Meteor.users = Accounts.users;
However, I am wondering if
- there’s a better way around this?
- is this a common enough issue that others have ran into?
I would be happy to help contribute something to the accounts package so that the user collections name can be overriden from an environment variables (and would use default “users” if the variable is not provided)