Chapter 4 Lab 1 - Increment (decrement) Error

Hi Everyone, the instructions say to run this command to decrement the pop field back to what it was before Chapter 4.

db.zips.updateMany({ “city”: “HUDSON” }, { “$inc”: { “pop”: -10 } })

but I get this:

WriteError: Cannot apply $inc to a value of non-numeric type

I’ve tried more than once and have logged out of the shell and back in.

Assuming I ran the increment of +10 only one time, I came up with an answer, and was wrong twice. I have one more attempt left.

Is there an original copy of the zips collection somewhere that I can use to overwrite the existing one?

I’m stuck. Help! Thanks!!

You have to load sample data again

Chapter 4: Advanced CRUD Operations Lab 1: Logic Operators

Thank you. Please advise how to load the sample data again.

Hi @Peggy_Bishop,

Welcome to the MongoDB Community Forum.

Follow this link.
After Opening your Atlas Account.

Click on three dots that appear beside the COLLECTIONS button.

Click on Load Sample Dataset.

That will load the Sample Data in your Atlas account.

Edit 1: If it shows An error occurred loading sample data: Target cluster does not have enough free space to import a dataset.

Then remove the previous database and then try again.

With the M0 cluster, you only get 500 MB of space. The dataset is of size ~ 350 MB.

I hope it answers your questions.
Feel free to reach out for any further questions.