I deleted the 'comments' collection

In playing around with the aggregation pipeline, I somehow blew away the comments collection. I think it involved the $out operator. I am sure I am not the first student to do this, nor will I be the last.

How do I restore the default data?

Found it!

For anyone else who needs to reset the data, the answer is in Chapter 1, in an ungraded lab called Import Dataset

All the data required for MFlix is contained in the data/ directory in the handout. To import this data into Atlas, use the following command (with your Atlas URI string filled in):

mongorestore --drop --gzip --uri <your-atlas-uri> data

A few tips when running mongorestore:

  • The --username and --password flags cannot be used with and SRV string. Instead, include the username and password in the SRV string (i.e. mongodb+srv://m220student:m220password@)
  • In order to work properly, this command must be run from the top-level of the mflix-/ directory, where is your chosen programming language.

You can verify that the data was imported by connecting to Atlas:

mongo <your-atlas-uri>

4 Likes

What’s even funnier is that I meant this for M220JS: MongoDB for JavaScript Developers. Oh well…!