MongoDB:nodejs the options [safe] is not supported

the options [safe] is not supported

修改为 :

MongoClient.connect(db_url, { useNewUrlParser: true }, function(err, db) {
        assert.equal(null, err);
        assert.ok(db != null);
        //acl_id
        db.collection("numbs").findAndModify({ _id: seq_name }, [], { $inc: { seq: 1 } }, { new: true }, function(err, result) {
            if (err) {
                logger.error(err);
                return cb(err);
            }
            var seq = JSON.stringify(result.value.seq) * 1;
            logger.debug('增加的序列为: ' + seq);
            next(seq);
            db.close();
        });
    });

猜你喜欢

转载自blog.csdn.net/shunzi2016/article/details/107726815