You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
warning: possible EventEmitter memory leak detected. 51 listeners added. Use emitter.setMaxListeners() to increase limit.
seems like 50 maximum listener limit defined inside the the library has been reached. I've try to google it and several sites said that the listener will be queued before connection made to mongodb.
are there more proper-and-not documented way provided to use mongoskin in such condition? are there any way to make node.js ignoring event listener addition?
The text was updated successfully, but these errors were encountered:
#39 and #44 were helpful. In my case, the code is part of a standalone script (so the usual initialization code that I use on the server doesn't work here). By the time the update is called, the db connection hasn't been opened yet.
As a workaround, I am using this piece of code to wait until the db is connected, but it is a hack, so I was wondering what is the semantically correct way, using MongoSkin:
var mongo = require('mongoskin'),
db = mongo.db('mongodb://localhost/db', {safe: true});
// hack to make sure DB is open
db.collection('subscriptions').findOne(function(err) {
// process a file here, and find what needs to be updated
db.subscriptions.update({foo: bar}, {$set: {'bar.baz': true}), function(err) {
if (err) console.error(err.toString());
}
});
hello, I have problem with mongoskin usage. I use it to move data from postgresql to mongodb. I use loop to move each data like this:
docs.forEach(function(item){
db.docs.insert(item, function(err){
});
mongoskin always printed following warning:
warning: possible EventEmitter memory leak detected. 51 listeners added. Use emitter.setMaxListeners() to increase limit.
seems like 50 maximum listener limit defined inside the the library has been reached. I've try to google it and several sites said that the listener will be queued before connection made to mongodb.
are there more proper-and-not documented way provided to use mongoskin in such condition? are there any way to make node.js ignoring event listener addition?
The text was updated successfully, but these errors were encountered: