Chris
Chris

Reputation: 14250

meteor/mongodb: Use different DB for authentication & read/write

meteor allows to specify the DB using the env variable MONGO_URL:

"mongodb://user:password@host:port/meteorDB"

Meteor will then automatically use the "meteorDB" database to authenticate against and all collections will refer to this database and read/write to it.

However, I use mongodb cloud manager to setup my users. It saves all users to the admin DB rather than having separate users saved in each database. I would like to use the "admin" DB for authentication and the "meteorDB" for data storage. Is this possible?

Upvotes: 1

Views: 315

Answers (1)

Stephen Woods
Stephen Woods

Reputation: 4049

Yep, here's a code snippet of how to tie a collection to a different MongoDB URL:

var db = new MongoInternals.RemoteCollectionDriver("<ONE OF YOUR DBS>");
MyCollection = new Mongo.Collection("<YOUR COLLECTION>", { _driver: db });

Upvotes: 1

Related Questions