Javascript 小鹿说“这是什么意思?”;“无效条件”;

Javascript 小鹿说“这是什么意思?”;“无效条件”;,javascript,node.js,mongodb,npm,mongoose,Javascript,Node.js,Mongodb,Npm,Mongoose,正如文档所说,我初始化了fawn,但仍然收到了一条错误消息无效条件,那么有什么问题吗? 谢谢你的帮助 await new Fawn.Task() .save('chefs', chef) .update('recipes', targetRecipe.id, { targetRecipe }) .update('foodcategories', targetRecipe.foodCategory, {

正如文档所说,我初始化了fawn,但仍然收到了一条错误消息
无效条件
,那么有什么问题吗? 谢谢你的帮助

await new Fawn.Task()
                .save('chefs', chef)
                .update('recipes', targetRecipe.id, { targetRecipe })
                .update('foodcategories', targetRecipe.foodCategory, { recipes: targetRecipe })
                .run();

正如你在文件上看到的。 [小鹿更新][1] [1]: https://npmjs.com/package/fawn#task_update 条件必须与mongoose和mongodb中的条件相同,因此需要像这样编写:

await new Fawn.Task()
            .save('chefs', chef)
            .update('recipes', { _id: targetRecipe.id }, { targetRecipe })
            .update('foodcategories', { foodCategory: targetRecipe.foodCategory }, { recipes: targetRecipe })
            .run();
我不知道foodCategory是否是您模式的关键,但它只是一个示例