Created
August 3, 2019 20:15
-
-
Save ShawonAshraf/30c9b1170e1fdbca3b7541ca90303908 to your computer and use it in GitHub Desktop.
Code for mongodb-nodejs-medium article
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const docToUpdate = { name: 'Halo MCC' }; | |
| const updateTerm = { $set: { name: 'Halo Master Chief Collection' } }; | |
| console.log('Before update :'); | |
| let haloMcc = await db.collection('games').findOne(docToUpdate); | |
| console.log(haloMcc); | |
| await updateDoc(db, docToUpdate, updateTerm); | |
| // check | |
| haloMcc = await db.collection('games').findOne({ | |
| name: 'Halo Master Chief Collection' | |
| }); | |
| console.log('After update :') | |
| console.log(haloMcc); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment