I am trying to execute a custom query in strapi by following the documentation on https://strapi.io/documentation/v3.x/concepts/queries.html#custom-queries
However I keep running into the error that the toObject function is not defined
My approach:
const result = strapi.query('balance').model.find({
_id: "5f319bd650d74b153c8329dd",
});
console.log(result)
const fields = result.toObject()
Error:
TypeError: result.toObject is not a function
In this case you shouldn't need to use a .toObject() but you do need to make the query an async/await.