Multiple remote database connections closed error: write EPIPE

We are using different databases to store user’s data. For example, user’s general information (login, password, profile info, etc) stored in the main database, but if the user has own contacts, tasks or other information, they will be stored at the separate database.
Connection to the database looks like this:

var userId = this.userId;
var database = new MongoInternals.RemoteCollectionDriver('mongodb://localhost:27017/' + userId);
var collection = database.open('tasks');

Generally, it works even at the production stage but sometimes Meteor fails to connect to separate databases. I"Error: write EPIPE" & “MongoError: connection to example.com:27017 closed”). So we don’t know why this error occurs.
Here is the screenshot of the logs we’ve got after failing to connect:
Screenshot

1 Like

have you tried to restart meteor server? :smiley: