These are chat archives for Automattic/mongoose

24th
Apr 2019
Srinivasan
@kksrini89
Apr 24 06:43

Hey guys, I am using mongoose

package.json
{
  mongoose: "^5.0.11"
}

I am facing an issue while doing findOneAndUpdate with toObject

let result = await usermodel.findOneAndUpdate({ _id: id }, { $set: { name: 'mongo' } }, { new:true, runValidators: true }).exec();

When I do result.toObject() getting an error result.toObject is not a function