1
votes

I develop a multi tenant application where each tenant has its own mongo db. All tenants share the same UI.

I should have one mongo db for all users accounts and each mongo db for data.

I'm new in meteor and i would like to know how i can dynamically select the database when i publish the collections.

    export const collects = new MongoObservable.Collection('collectionname',{
    connection:DDP.connect('urltomongodb')

});

Any help please

1
I don't believe you can do that easily, but you should be able to select your collections dynamically. Would that help? - Tomasz Lenarcik
Did you ever find any answers - solutions related with this one? - cool

1 Answers

1
votes

As far as I know the DDP utilities are available for people who wish to connect to a Meteor server from a non-Meteor platform, either front end or server.

There is, of course, nothing to stop you using DDP.connect() to connect to another server, but you will also need to manage that connection, and any retries etc if it becomes unavailable.

I would suggest an easier path is to manage all of your data in one database - trying to separate them becomes non-trivial, because it is doing something that Meteor doesn't normally do. If you structure your data accordingly, it should be quite feasible to keep all the data in one database