Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongodb deprecated warning fix #287

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions lib/mongodb-backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ MongoDBBackend.prototype = {
values.forEach(function(value){doc[value]=true;});

// update document
collection.update(updateParams,{$set:doc},{safe:true,upsert:true},function(err){
collection.updateOne(updateParams, {$set:doc}, {w:1, upsert:true}, function(err){
if(err instanceof Error) return cb(err);
cb(undefined);
});
Expand All @@ -135,7 +135,7 @@ MongoDBBackend.prototype = {
transaction.push(function(cb) {
self.db.collection(self.prefix + self.removeUnsupportedChar(collName), function(err,collection){
// Create index
collection.ensureIndex({_bucketname: 1, key: 1}, function(err){
collection.createIndex({_bucketname: 1, key: 1}, function(err){
if (err instanceof Error) {
return cb(err);
} else{
Expand All @@ -161,7 +161,7 @@ MongoDBBackend.prototype = {
transaction.push(function(cb){
self.db.collection(self.prefix + self.removeUnsupportedChar(collName),function(err,collection){
if(err instanceof Error) return cb(err);
collection.remove(updateParams,{safe:true},function(err){
collection.deleteMany(updateParams, {w:1}, function(err){
if(err instanceof Error) return cb(err);
cb(undefined);
});
Expand Down Expand Up @@ -191,7 +191,7 @@ MongoDBBackend.prototype = {
values.forEach(function(value){doc[value]=true;});

// update document
collection.update(updateParams,{$unset:doc},{safe:true,upsert:true},function(err){
collection.updateOne(updateParams, {$unset:doc}, {w:1, upsert:true}, function(err){
if(err instanceof Error) return cb(err);
cb(undefined);
});
Expand Down Expand Up @@ -277,4 +277,4 @@ function makeArray(arr){
return Array.isArray(arr) ? encodeAll(arr) : [encodeText(arr)];
}

exports = module.exports = MongoDBBackend;
exports = module.exports = MongoDBBackend;