Answers for "mongoose findone exclude perticular field"

0

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")
Posted by: Guest on July-29-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language