Comments (4)
It's probably because you are passing a MongoClient instance to mongodb-queue that is a newer version than the outdated one used by this module. The new versions do not automatically create a Db instance, so you should use client.db('name'), but also the method Db.collection without a callback used here in strict mode is deprecated in current versions:
http://mongodb.github.io/node-mongodb-native/2.2/api/Db.html#collection
http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#collection
from mongodb-queue.
versions should be fixed in #28
otherwise it's totally up to NPM to always install the latest mongodb package, which will prevent people from running this nice queue.
NOTE: this only works standalone. Chances are that you're already running some kind of mongodb version.
from mongodb-queue.
MongoDB 3.x introduced a breaking change: mongodb.MongoClient.connect
doesn't return a mongodb.Db
instance but a mongodb.MongoClient
instead, so @rncortes1990 example should be changed into:
var mongodb = require('mongodb')
var mongoDbQueue = require('mongodb-queue')
var con = 'mongodb://localhost:27017/test'
mongodb.MongoClient.connect(con, function(err, client) {
var db = client.db('test') // notice this
var queue = mongoDbQueue(db, 'my-queue')
})
And it should work as expected.
See for more: https://github.com/mongodb/node-mongodb-native/blob/master/CHANGES_3.0.0.md
from mongodb-queue.
v4.0.0 was released around 7 months ago and I think it should fix your problem. Please re-open if this isn't the case. Many thanks.
from mongodb-queue.
Related Issues (18)
- get() method doesn't follow the FIFO HOT 10
- Incorrect indexes? HOT 8
- findOneAndUpdate vs findAndModify HOT 6
- Long polling with queue.get? HOT 6
- Date type instead of string for datetime fields HOT 2
- Dead Queues Management HOT 1
- concurrency? HOT 4
- for await...of as interface for queue consumer
- How can i connect this with mongoose? HOT 2
- returnOriginal flag is deprecated in findOneAndUpdate
- Batch Processing
- message order after visibility timeout HOT 4
- Using mongdb nodejs driver 4 HOT 2
- Error acknowledging a queue: Queue.ack(): Unidentified ack HOT 3
- Support for node-mongodb-native2 HOT 3
- Support MongoDB 3.x HOT 3
- awesome package, how to work on all queued messages effectively? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongodb-queue.