Use case: the app I built on app.foo.com
, and an instance of telescope on community.foo.com
, on separate application servers. The only collection they'd share is users
. I would give the same mongo url and oplog url to both apps, and make sure that other than users
, collection names did not overlap between the two apps.
Should this work fine? Any performance concerns?
The problem with this is you have to share the collection names.
If you use your databases you're also insured against Telescope suddenly using a collection name that your other app uses on a future version too.
What you can do is only share the users
collection if you want.
Server side code (not needed on client)
Accounts.connection = DDP.connect("https://<telescope app url>");
Meteor.users = new Mongo.Collection("users", {
_preventAutopublish: true,
connection: Accounts.connection
});
Or more directly (not preferable if you're allowing OAuth logins)
var database = new MongoInternals.RemoteCollectionDriver("<mongo url of telescope app>");
Meteor.users = new Mongo.Collection("users", { _driver: database });
So this app now uses the Telescope app's user's collection.