Following this tutorial, I have a mongoose model: (I\'m using the term \"Account\" instead of \"Todo\", but it\'s the same thing)
const Account = mongoose.m
I used ID
and it works fine! cause of your problem is not id's type! it's becuase you provide it with wrong value: ObjectID('actuall id')
In order to fix this issue, call toJson
function for each fetched data, or simply add a virtual id
like this:
YourSchema.virtual('id').get(function() {
return this.toJSON()._id
}