Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/mongodb-backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ MongoDBBackend.prototype = {
this.db.collection(this.prefix + this.removeUnsupportedChar(collName),function(err,collection){
if(err instanceof Error) return cb(err);
// Excluding bucket field from search result
collection.findOne(searchParams, {_bucketname: 0},function(err, doc){
collection.findOne(searchParams, {projection: {_bucketname: 0}},function(err, doc){
if(err) return cb(err);
if(! _.isObject(doc) ) return cb(undefined,[]);
doc = fixKeys(doc);
Expand All @@ -88,7 +88,7 @@ MongoDBBackend.prototype = {
this.db.collection(this.prefix + this.removeUnsupportedChar(collName),function(err,collection){
if(err instanceof Error) return cb(err);
// Excluding bucket field from search result
collection.find(searchParams, {_bucketname: 0}).toArray(function(err,docs){
collection.find(searchParams, {projection: {_bucketname: 0}}).toArray(function(err,docs){
if(err instanceof Error) return cb(err);
if( ! docs.length ) return cb(undefined, []);

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"async": "^2.1.4",
"bluebird": "^3.0.2",
"lodash": "^4.17.3",
"mongodb": "^2.0.47",
"mongodb": "^3.1.1",
"redis": "^2.2.5"
},
"devDependencies": {
"mocha": "^3.2.0",
"chai": "^3.4.0"
"mocha": "^5.2.0",
"chai": "^4.1.2"
},
"scripts": {
"test": "mocha test/runner.js --reporter spec",
"test": "mocha test/runner.js --reporter spec --exit",
"cover": "istanbul cover -- _mocha test/runner.js --reporter spec"
}
}
6 changes: 4 additions & 2 deletions test/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ describe('MongoDB - Default', function () {
var self = this
, mongodb = require('mongodb')

mongodb.connect('mongodb://localhost:27017/acltest',function(error, db) {
mongodb.connect('mongodb://localhost:27017/acltest',function(error, client) {
const db = client.db('acltest');
db.dropDatabase(function () {
self.backend = new Acl.mongodbBackend(db, "acl")
done()
Expand All @@ -24,7 +25,8 @@ describe('MongoDB - useSingle', function () {
var self = this
, mongodb = require('mongodb')

mongodb.connect('mongodb://localhost:27017/acltest',function(error, db) {
mongodb.connect('mongodb://localhost:27017/acltest',function(error, client) {
const db = client.db('acltest');
db.dropDatabase(function () {
self.backend = new Acl.mongodbBackend(db, "acl", true)
done()
Expand Down