Grokking MongoDB
0% completed
Update Operations
Correcting one line on a paper form is different from filling in a new form and throwing the old one away. MongoDB offers both actions. updateOne() and updateMany() change named fields and leave the rest alone, while replaceOne() swaps the whole document for a new one.
This lesson covers the first action, changing named fields. Its examples build on each other, so run them in order. They start from these three users.
db.users.drop() db.users.insertMany([ { name: "Alice", age: 25, email: "alice@example.com", tags: ["new", "trial"] }, { name: "Bob",
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%