Use additional MongoDB databases in your Meteor app.
$ meteor add maxfi:remote-collection
On client or server:
// using a MongoDB URI
MyCollection = new RemoteCollection('mongodb://username:password@localhost:27017/database');
// or using an environment variable
MyCollection = new RemoteCollection('SOME_ENV_VAR'); // Where `process.env.SOME_ENV_VAR`
// optionally pass in connection options
var connectionOptions = {oplogUrl: 'mongodb://username:password@localhost:27017/local?authSource=admin'};
MyCollection = new RemoteCollection('SOME_ENV_VAR', connectionOptions);
// or optionally pass in OPLOG URI
MyCollection = new RemoteCollection('SOME_ENV_VAR', 'SOME_OTHER_ENV_VAR'); // Where `process.env.SOME_OTHER_ENV_VAR`
- Potentially reuse
MongoInternals.RemoteCollectionDriver
across multipleRemoteCollection
instances.