Facing problem while executing upserts

when i am running the query for upserts as discussed in lecture for upserts so when i am running it so query doesn’t executed successfully and it is showing that “detail” is not defined so how should i tackle this problem.

Hey @Akash_06246

What problem are you trying to tackle? Did you define the detail variable as shown in the video at 0:09? What does your command look like that is failing?

imdb.id”:detail.imdb.id what this denotes actually i don’t get it.

Ok so the following query means,

db.movieDetails.find({
  "imdb.id": detail.imdb.id
}, {
  $set: detail
})

To search the movieDetail collection and find and documents that have an imdb.id value equal to the id value on the detail variable’s imdb field, or detail.imdb.id

From the Docs

The mongo shell is an interactive JavaScript interface to MongoDB. You can use the mongo shell to query and update data as well as perform administrative operations.

I have the same problem. In the m001 Lesson2 13 it is not clear what we supposed to do. Do we supposed to execute the script in the video?
Why do I get an error ? see the screenshot:

Hi @Daniel_19485,

In Lecture: Upserts, the instructor has defined the detail variable at 0:09. The error is being thrown because you have not defined it in your case.

If you have any other issue, please feel free to get back to us.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

@Shubham_Ranjan The lecture upserts hyperlink you posted is broken.
Video should have details at the end stating that the variables such as “let detail” DO matter, as the instructor states that we can ignore that for now, but it is not introduced afterwards which creates ambiguity for the students. Cheers

Hi @dev_js,

Yeah, you cannot access the link since you are not enrolled in that offering. Sorry about that. You can find this video lecture listed in Chapter 2: The MongoDB Query Language + Atlas.

Thanks for the feedback. We will look into it and we will update the Lecture Notes accordingly.

~ Shubham