From c9d71aa38fc0631f3ce49017200bd38d3bc2e5d1 Mon Sep 17 00:00:00 2001 From: Slava Kim Date: Tue, 21 May 2013 14:30:41 -0700 Subject: [PATCH] Expose the 'close' method for mongo driver. --- packages/mongo-livedata/mongo_driver.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/mongo-livedata/mongo_driver.js b/packages/mongo-livedata/mongo_driver.js index f7c9ff16a0..9b5ee26056 100644 --- a/packages/mongo-livedata/mongo_driver.js +++ b/packages/mongo-livedata/mongo_driver.js @@ -123,6 +123,14 @@ _Mongo = function (url) { }); }; +_Mongo.prototype.close = function() { + var self = this; + // Use Future.wrap so that errors get thrown. This happens to + // work even outside a fiber since the 'close' method is not + // actually asynchronous. + Future.wrap(_.bind(self.db.close, self.db))(true).wait(); +}; + // Returns the Mongo Collection object; may yield. _Mongo.prototype._getCollection = function(collectionName) { var self = this;