-
Notifications
You must be signed in to change notification settings - Fork 369
Description
i am using ACL module with mongodb, i define some roles and their permissions using the acl.allow() function.
const node_acl = require('acl');
const mongodb = require('mongodb');
let acl = null;
mongodb.connect(config.db.uri, (error, db) => {
if (error) {
throw error;
}
console.log('connected ..........',config.db.uri,db); // running successfully
var mongoBackend = new node_acl.mongodbBackend(db, 'acl_', true);
acl = new node_acl(mongoBackend);
});
I am sure the database is connected, but the code running above gave me an error saying
_Unhandled rejection TypeError: self.db.collection is not a function
at /Users/abc/Documents/projects/game/server/node_modules/acl/lib/mongodb-backend.js:120:15
at /Users/abc/Documents/projects/game/server/node_modules/async/dist/async.js:3853:24
at replenish (/Users/abc/Documents/projects/game/server/node_modules/async/dist/async.js:946:17)
at /Users/abc/Documents/projects/game/server/node_modules/async/dist/async.js:950:9
at eachOfLimit (/Users/abc/Documents/projects/game/server/node_modules/async/dist/async.js:975:24)
at /Users/abc/Documents/projects/game/server/node_modules/async/dist/async.js:980:16
at parallel (/Users/abc/Documents/projects/game/server/node_modules/async/dist/async.js:3852:5)
at Object.series (/Users/abc/Documents/projects/game/server/node_modules/async/dist/async.js:4708:5)
at MongoDBBackend.end (/Users/abc/Documents/projects/game/server/node_modules/acl/lib/mongodb-backend.js:36:11)
at Acl.allow (/Users/abc/Documents/projects/game/server/node_modules/acl/lib/acl.js:346:26)