Script for updateOne and updateMany

Where is the script for updateOne and updateMany ?Can we download the commands typed in the training ?
Thanks
Angie

1 Like

We should build those queries on our own, that’s the point :slight_smile:

Hi Angie,

You can see examples on docs.mongodb.com. If you need help with specific commands, please share the concern so that I can help.

Here are few examples:

db.restaurant.updateOne(
  { "name" : "Central Perk Cafe" },
  { $set: { "violations" : 3 } }
);

db.restaurant.updateMany(
  { violations: { $gt: 4 } },
  { $set: { "Review" : true } }
);

https://docs.mongodb.com/manual/reference/method/db.collection.updateOne/index.html#examples
https://docs.mongodb.com/manual/reference/method/db.collection.updateMany/index.html#examples

Kanika

The point was to ask about inconsistency in handouts across the course module. Your response was very unhelpful

Thanks Kanika I completed all the modules

We can’t. The video, at 4:41, explicitly says to copy and past the command and all its parameters. There’s nothing to copy FROM, it’s a VIDEO. Nor is it possible to re-create the command onscreen, particularly the part where we are supposed to add a link to a poster to the movie details for “The Martian”. The URI for that poster is long and tricky, and not all of it is visible onscreen. Even if I build that query myself, I don’t know what URI we’re supposed to be using. The Lecture Notes should have a copy-able version of that command but it does not.

1 Like