Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongoose virtual

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

userSchema.set('toJson', {virtual: true})
 
PREVIOUS NEXT
Tagged: #mongoose #virtual
ADD COMMENT
Topic
Name
7+5 =