We are using different databases to store user’s data. For example, user’s general information (login, password, profile info, etc) stored in the meteor database, but if the user has own contacts, tasks or other information, they will be stored at the separate databases created for each user based on id.
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 other 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: https://image.ibb.co/eR74K6/Screen_Shot_2018_01_06_at_11_30_26_AM.png