I have a service in ruby and I trying to connect with two different hosts with two different databases
I'm trying something like this
mongoid.yml
development:
clients:
default:
database: cpeTracking
hosts:
- development-shard.mongodb.net:27017
- development-shard.mongodb.net:27017
- development-shard.mongodb.net:27017
options:
user: my_user
password: my_password
auth_source: admin
ssl: true
database: testDb
hosts:
- localhost:27017
And my model
class Movies
include Mongoid::Document
include Mongoid::Attributes::Dynamic
store_in database: "testDb"
field :name, type: String
field :year, type: Integer
field :director, type: String
end
When I run the service, only connect with the first host. I also tried this solution Connecting to two databases Mongoid but didn't work