Node.js Mongoose架构验证不适用于Fawn

Node.js Mongoose架构验证不适用于Fawn,node.js,mongodb,mongoose,mean-stack,mongoose-schema,Node.js,Mongodb,Mongoose,Mean Stack,Mongoose Schema,我正在开发一个MEAN应用程序,并尝试使用FAWN实现MongoDB的行为等事务。我在用猫鼬图书馆。当我使用fawn时,数据有点跳过模式条件,比如sellingPrice的min:1。然而,我在run中也使用了{useMongoose:true} var mongoose = require('mongoose'); var Fawn = require('fawn'); Fawn.init(mongoose); //Function code is a

我正在开发一个MEAN应用程序,并尝试使用FAWN实现MongoDB的行为等事务。我在用猫鼬图书馆。当我使用fawn时,数据有点跳过模式条件,比如sellingPrice的min:1。然而,我在run中也使用了{useMongoose:true}

    var mongoose = require('mongoose');
    var Fawn = require('fawn');    
    Fawn.init(mongoose);

    //Function code is as follow

        var task = Fawn.Task();
        let item = await Item.findById(req.params.id);

        task.update('items', {_id: item._id}, {type: req.body.type, name: req.body.name, sku: req.body.sku, openingStock: req.body.openingStock, availableStock: req.body.availableStock, purchasePrice: req.body.purchasePrice, sellingPrice: req.body.sellingPrice, profitMargin: req.body.profitMargin, reorderLevel: req.body.reorderLevel, preferredVendor: req.body.preferredVendor});
        task.update('items', {_id: item._id}, {sellingPrice: -50});//This line should fail because min value for sellingPrice is 1
        task.run({ useMongoose: true })
            .then(function(){res.json(item);})
            .catch(function(error){res.json({error: {"message": error}});});

我在更新过程中遇到了许多类似的问题,但最终,以下方面起到了作用:

try {
  await new Fawn.Task()
  .update('collection', 
               { _id: mongoose.Types.ObjectId(req.params.id) } , 
               { name: 'test', desc: 'description })
  .run({useMongoose: true});
} 
catch(err) { console.log(err); }

如何修复此警告:
(节点:57487)弃用警告:collection.update已弃用。改用updateOne、updateMany或bulkWrite。