正如文档所说,我初始化了mall,但仍然收到一条错误消息Invalid Condition
,那么怎么了?谢谢你的帮助。
await new Fawn.Task()
.save('chefs', chef)
.update('recipes', targetRecipe.id, { targetRecipe })
.update('foodcategories', targetRecipe.foodCategory, { recipes: targetRecipe })
.run();
初始化小鹿时,使用Fawn.init("mongodb://localhost/dbName");
代替Fawn.init(mongoose);
如您在文档中所见。[Fawn更新][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是否是你的模式的关键,但它只是一个例子。