Answers for "_id to id"

1

_id to id

userSchema.virtual('id').get(function () {
    return this._id.toHexString();
})

userSchema.set('toJson', {virtual: true})
Posted by: Guest on June-11-2021

Browse Popular Code Answers by Language