Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongoose updateone example

// Update the document using `updateOne()`
await CharacterModel.updateOne({ name: 'Jon Snow' }, {
  title: 'King in the North'
});

// Load the document to see the updated value
const doc = await CharacterModel.findOne();
doc.title; // "King in the North"
Source by masteringjs.io #
 
PREVIOUS NEXT
Tagged: #mongoose #updateone
ADD COMMENT
Topic
Name
9+3 =