MongoMapper and several databases in the application

Is it possible to use MongoMapper in an application that stores its models in many databases? For example, I have a shared database for Users, and another for Orders, and I want to simulate a user and order using MongoMapper. Of course, I can switch the MongoMapper.connection attribute, but it is potentially dangerous due to the state of the race.

+1
source share
1 answer

You can establish a connection for each model:

User.connection(Mongo::Connection.new('localhost', 27017))

+1
source

Source: https://habr.com/ru/post/1399374/


All Articles