【发布时间】:2020-02-14 21:02:20
【问题描述】:
我添加了这个 GraphQL 解析器函数,
switchEventSellingStarted: async(_, {name, sellingStarted}) => {
const e1 = Event.findOne({name: name})
if (!e1) {
throw new Error(`Couldn't find post with id ${name}`);
}
e1.sellingStarted = sellingStarted;
await e1.save();
return e1;
}
在执行resolver时出现这个错误,为什么?
{
"errors": [
{
"message": "e1.save is not a function",
【问题讨论】: