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');
 
PREVIOUS NEXT
Tagged: #updateone #mongoose
ADD COMMENT
Topic
Name
2+7 =