Strapi toObject() 不是函数错误

Strapi toObject() is not a function error

我正在尝试按照以下文档在 strapi 中执行自定义查询 https://strapi.io/documentation/v3.x/concepts/queries.html#custom-queries

但是我一直运行报toObject函数未定义的错误

我的做法:

const result = strapi.query('balance').model.find({
          _id: "5f319bd650d74b153c8329dd",
        });
        console.log(result)
        const fields = result.toObject()

错误:

TypeError: result.toObject is not a function

在这种情况下,您不需要使用 .toObject(),但您确实需要使查询成为 async/await.