Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

updateone mongoose example

const userObjectId = mongoose.Types.ObjectId(userIdString);

await UserModel.updateOne({ _id: userObjectId }, { $set: { isVerifiedEmail: true } }).catch(
  error => {
     console.log(error);
   }
);
console.log('user updated');
Source by masteringjs.io #
 
PREVIOUS NEXT
Tagged: #updateone #mongoose
ADD COMMENT
Topic
Name
4+5 =