elbywan / moongoon

An object-document mapper for MongoDB. 🌙
https://elbywan.github.io/moongoon/
MIT License
44 stars 3 forks source link

Multi DB? #8

Closed Nicolab closed 3 years ago

Nicolab commented 3 years ago

Hello,

Does Mongoon support multi DB connection?

elbywan commented 3 years ago

Hey @Nicolab,

Does Mongoon support multi DB connection?

Well it depends on the meaning of "db".

If you mean DB as a mongodb server deployment (mongod, mongos), then moongoon supports various mongodb topologies (replicaset, sharded), including specifying multiple hostnames in the mongodb:// string or the mongodb+srv://scheme.

But it does not support connecting to completely distinct server deployments and picking the one you want when querying.

If you mean "db" as the database that stores collection of documents then yes. There is a database method you can use a specific database for a given model (see example here).

Nicolab commented 3 years ago

Ok, thanks for this answers detailled!

My question was about connecting to a distinct server but by the way your other answers are interesting (I just started using Mongoon).

By the way, congratulations for this ODM. The API is really good. Crystal has its own Mongoose equivalent. :+1: