chilts / mongodb-queue

Message queues which uses MongoDB.
209 stars 91 forks source link

Support for node-mongodb-native2 #6

Closed ozomer closed 8 years ago

ozomer commented 9 years ago

There were few changes in the mongodb npm package in version 2 (the current "default" version is 2.0.42). The insert command is marked as deprecated, and its callback gets a different result object: http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#~insertWriteOpResult

mongodb-queue.js fails at line 78 (Queue.add function):

self.col.insert(msg, function(err, results) {
    if (err) return callback(err)
    callback(null, '' + results[0]._id)
})

results[0] is undefined...

chilts commented 8 years ago

Is this what you're looking for https://github.com/chilts/mongodb-queue/pull/5 ?

That PR updates to v2 of the driver.

ozomer commented 8 years ago

Yes, but we already switched to RabbitMQ :)

chilts commented 8 years ago

That's cool, it will probably serve you better for big sites anyway. This is just for those little sites that are already using Mongo. Thanks for your initial issue anyway. :)