Skip to content

Commit

Permalink
Merge PR 267
Browse files Browse the repository at this point in the history
  • Loading branch information
balbuzar committed Jan 18, 2019
1 parent 89b8541 commit 2560947
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
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
6 changes: 3 additions & 3 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.12",
"redis": "^2.2.5"
},
"devDependencies": {
"mocha": "^3.2.0",
"chai": "^3.4.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

0 comments on commit 2560947

Please sign in to comment.