peerlibrary / meteor-peerdb

Reactive database layer with references, generators, triggers, migrations, etc.
http://atmospherejs.com/peerlibrary/peerdb
BSD 3-Clause "New" or "Revised" License
130 stars 15 forks source link

Option to specify the mongo driver #43

Closed MatejJan closed 8 years ago

MatejJan commented 8 years ago

Sometimes you need to connect to multiple mongo databases from the same app. That can be done by specifying the internal mongo driver when creating the collection as show here:

var database = new MongoInternals.RemoteCollectionDriver("<mongo url>");
MyCollection = new Mongo.Collection("collection_name", { _driver: database });

This could work in PeerDB in a similar fashion that you can specify a custom collection to use.

mitar commented 8 years ago

Hm, so why not specifying then this MyCollection to PeerDB?

See here example for custom DDP connection. You can do a similar thing for multiple databases, no?

But really, multiple MongoDB databases, what type of an app you are doing? ;-)

MatejJan commented 8 years ago

Ah, yes, I forget that you can pass exactly which collection to use directly as well.

I was going to have store purchases in a separate database than the main app db. I'm now reconsidering how useful this is. :)