Skip to content

Commit 2560947

Browse files
committed
Merge PR 267
OptimalBits#267
1 parent 89b8541 commit 2560947

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

lib/mongodb-backend.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ MongoDBBackend.prototype = {
6565
this.db.collection(this.prefix + this.removeUnsupportedChar(collName),function(err,collection){
6666
if(err instanceof Error) return cb(err);
6767
// Excluding bucket field from search result
68-
collection.findOne(searchParams, {_bucketname: 0},function(err, doc){
68+
collection.findOne(searchParams, {projection: {_bucketname: 0}},function(err, doc){
6969
if(err) return cb(err);
7070
if(! _.isObject(doc) ) return cb(undefined,[]);
7171
doc = fixKeys(doc);
@@ -88,7 +88,7 @@ MongoDBBackend.prototype = {
8888
this.db.collection(this.prefix + this.removeUnsupportedChar(collName),function(err,collection){
8989
if(err instanceof Error) return cb(err);
9090
// Excluding bucket field from search result
91-
collection.find(searchParams, {_bucketname: 0}).toArray(function(err,docs){
91+
collection.find(searchParams, {projection: {_bucketname: 0}}).toArray(function(err,docs){
9292
if(err instanceof Error) return cb(err);
9393
if( ! docs.length ) return cb(undefined, []);
9494

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
"async": "^2.1.4",
1919
"bluebird": "^3.0.2",
2020
"lodash": "^4.17.3",
21-
"mongodb": "^2.0.47",
21+
"mongodb": "^3.1.12",
2222
"redis": "^2.2.5"
2323
},
2424
"devDependencies": {
2525
"mocha": "^3.2.0",
26-
"chai": "^3.4.0"
26+
"chai": "^4.1.2"
2727
},
2828
"scripts": {
29-
"test": "mocha test/runner.js --reporter spec",
29+
"test": "mocha test/runner.js --reporter spec --exit",
3030
"cover": "istanbul cover -- _mocha test/runner.js --reporter spec"
3131
}
3232
}

test/runner.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ describe('MongoDB - Default', function () {
77
var self = this
88
, mongodb = require('mongodb')
99

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

27-
mongodb.connect('mongodb://localhost:27017/acltest',function(error, db) {
28+
mongodb.connect('mongodb://localhost:27017/acltest',function(error, client) {
29+
const db = client.db('acltest');
2830
db.dropDatabase(function () {
2931
self.backend = new Acl.mongodbBackend(db, "acl", true)
3032
done()

0 commit comments

Comments
 (0)