From 2fdde660bcf0c3d9c1c90ee18e22a25478fa3bce Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Sat, 30 May 2015 01:06:24 +0200 Subject: [PATCH] Updated MongoAscoltatore to MongoDB driver v2.0.0 --- lib/mongo_ascoltatore.js | 12 ++++-------- package.json | 8 ++++---- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/mongo_ascoltatore.js b/lib/mongo_ascoltatore.js index 8af2a84..84ccc14 100644 --- a/lib/mongo_ascoltatore.js +++ b/lib/mongo_ascoltatore.js @@ -8,7 +8,7 @@ var SubsCounter = require("./subs_counter"); var debug = require("debug")("ascoltatori:mongodb"); var mongo = require('mongodb'); var MongoClient = require('mongodb').MongoClient; -var BSON = mongo.BSONPure; +var ObjectID = require('mongodb').ObjectID; var async = require("async"); /** @@ -46,7 +46,7 @@ var MongoAscoltatore = function(opts) { this._closed = false; this._handlingCursorFailure = false; - this._lastSuccessfulHandling = new BSON.ObjectID(); + this._lastSuccessfulHandling = new ObjectID(); this.wait = this._opts.wait || 100; @@ -76,7 +76,7 @@ var MongoAscoltatore = function(opts) { debug('ready'); // create a new object id. We will get all the events from now on - that._poll(new BSON.ObjectID()); + that._poll(new ObjectID()); that.emit('ready'); } @@ -146,11 +146,7 @@ MongoAscoltatore.prototype._handle = function(die, callback) { err = args.shift(); if (err && !that._closed) { - if (that._cursor && that._cursor.isClosed()) { - that._handleCursorClosed(that._lastSuccessfulHandling); - } else { - that.emit('error', err); - } + that._handleCursorClosed(that._lastSuccessfulHandling); return; } diff --git a/package.json b/package.json index ad3ac91..7d9e34c 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "sinon": "^1.10.3", "sinon-chai": "^2.6.0", "optimist": "~0.6.0", - "async_bench": "~0.4.0", + "async_bench": "~0.5.0", "dox-foundation": "0.5.4", "mosca": "git://github.com/mcollina/mosca.git", "jshint": "~2.5.2", @@ -62,15 +62,15 @@ "async": "~0.9.0", "debug": "^2.0.0", "node-uuid": "~1.4.0", - "qlobber": "~0.3.0" + "qlobber": "~0.5.0" }, "optionalDependencies": { "nan": "~1.8.4", "redis": "~0.12.1", - "hiredis": "^0.3.0", + "hiredis": "^0.4.0", "zmq": "~2.11.0", "amqp": "~0.2.4", - "mqtt": "~1.0.0", + "mqtt": "^1.0.0", "mongodb": "~2.0.33", "eventemitter2": "~0.4.14", "qlobber-fsq": "~0.3.0"