Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongoose findone exclude perticular field

//Return the User document without having password field
User.findOne({_id: userId}).select("-password")

//Incase wants to add excluded field
User.findOne({_id: userId}).select("+password")
Source by www.curtismlarson.com #
 
PREVIOUS NEXT
Tagged: #mongoose #findone #exclude #perticular #field
ADD COMMENT
Topic
Name
3+5 =