Skip to content

Commit

Permalink
don't call the cb twice in the same transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc MacLeod authored and Marc MacLeod committed Aug 13, 2015
1 parent 6396cdc commit c20e45c
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/mongodb-backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,21 @@ MongoDBBackend.prototype = {
if(err instanceof Error) return cb(err);
cb(undefined);
});
// Create index
collection.ensureIndex({_bucketname: 1, key: 1}, function(err){
if(err instanceof Error) { return cb(err);
}else{ cb(undefined);
}
});
});
});

transaction.push(function(cb) {
self.db.collection(self.prefix + collName, function(err,collection){
// Create index
collection.ensureIndex({_bucketname: 1, key: 1}, function(err){
if (err instanceof Error) {
return cb(err);
} else{
cb(undefined);
}
});
});
})
},

/**
Expand Down

0 comments on commit c20e45c

Please sign in to comment.