Mongo_users_url

Hi,

I was wondering whether anyone else needs to link a Meteor project to another Meteor Project’s User Collection.

I use three platforms, for this example I will call them App (Main app), BizApp and ChatApp. They all use the same user DB of App. I would like to avail of Meteor.users in all three apps where App requires reactivity and the others, BizApp and ChatApp do not need reactivity.

What I do now is to use a modified accounts-base package where

this.users = new Mongo.Collection("users", {
      _preventAutopublish: true,
      connection: this.connection
    });

is replaced by

 this.users = new Meteor.Collection('users', {
        _preventAutopublish: true,
        connection: this.connection,
        _driver: new MongoInternals.RemoteCollectionDriver(process.env.MONGO_USERS_URL, {})
      });

My question to you is how do you deal with this problem(if you have it, indeed)? Would you support the idea of having a Env variable such as ‘MONGO_USERS_URL’ that lets you connect into another Users Collection?

1 Like

I think @jkuester might have some experiences in this area.

I’ve not done this with users specifically but with logging and some other super heavy use databases. It works nicely. You can do something similar on the client to have an entirely different server serve your data for specific collections too (probably not useful for users though)

I find the environment variable solution works very nicely.