Closing opened connection to the remote database (RemoteCollectionDriver)

After connection to multiple databases by using MongoInternals.RemoteCollectionDriver we get a lot of opened connections. Meteor’s ‘mongo’ package does not contain any function for closing opened connections.
So, there is a link to the remote collection driver of this package: (

It has a function to open connections but there is not any function to close connections.

_.extend(MongoInternals.RemoteCollectionDriver.prototype, {
  open: function (name) {
    var self = this;
    var ret = {};
      ['find', 'findOne', 'insert', 'update', 'upsert',
       'remove', '_ensureIndex', '_dropIndex', '_createCappedCollection',
       'dropCollection', 'rawCollection'],
      function (m) {
        ret[m] = _.bind(self.mongo[m], self.mongo, name);
    return ret;

Is there any possible solution to close opened connections to the collections from remote database?

You can get a reference to the underlying database driver and with that, use the close() method. From an async function you can just do:

const closeResult = await someCollection.rawDatabase().close();

someCollection.rawDatabase().close(); closes all connections with all clients. How to close connection with a certain client?

I don’t think it’s easy. The connections are held by the server and just used indirectly by clients. I think you’d need to keep a track of client connections and disconnections and close the database only when all clients using that database have gone.