Problem in chapter 4 lab1 :logic operator

i don’t know if i can ask this but i was trying to solve this quiz and followed the instruction to count the documents that has population not more than 1000000 and not less than 5000 as follows : but i got wrong answer
db.zips.find( {"$nor": [{“pop” : {"$gte":1000000}} , {“pop”:{"$lte":5000}}]}).count()

11194

can someone assist please.

Regards,
Amro

I run the same query on my data set and I got the appropriate answer.

I suspect that you might have added or remove a document. My copy of the data set has 29470 documents total. How many in yours?

Hi Thank you for your answer i have 29470 , Screenshot 2020-10-07 at 20.58.32|690x323

Then may be you changed the pop field of a document to 1000000 or 5000.

In my data set I have none that have exactly 1000000 or 5000.

is there a way i can find new set to upload please to make sure ?
( despite i didn’t try to change any of the pop values)

In Atlas you can go in your cluster and press the three dots menu next to CONNECT, METRICS, and COLLECTIONS. You will get an item that says Load Sample Dataset.

Hi @Amro_Alfadil,

I am facing the same issue. Also, my answer is 11194 and it is showing “Incorrect! Try again.”

My Query is as given below,

db.zips.find({"pop" : {"$lt" : 1000000, "$gt" : 5000}}).count()

and it gives 11194.

When I submit the above answer, it shows the “Incorrect! Try again.”

Note: I am not sure if I have changed some of the zips JSON during practice or not. Let me try loading the sample dataset again.

Have you resolved the issue?

Hi @steevej-1495,

I am facing the same issue.

As you said above, I tried to load the sample dataset in my clusters but is sowing insufficient space warning. Maybe it is because the sample dataset is already loaded in my clusters.

Is there any way to drop the previously loaded sample dataset using the MongoDB Atlas dashboard?

Or

Do I have to drop every database using the Mongo Shell? In this case, do I have to drop admin and local databases too?

Hi @Amro_Alfadil,

I have resolved the issue.

I think I have manipulated the zips collection of the sample_training DB during practice, that’s why it was giving the wrong answer.

To clear the previously loaded sample dataset, I simply deleted the current cluster and added the new one with the same name i.e. Sandbox and loaded the sample dataset.

Now connect with the newly created cluster and it will give you the correct answer.

Happy Learning!

2 Likes

Hi @Gaurav_Kukade,

Thanks for surfacing this an I’m glad your issue got resolved. Please feel free to get back to us if you have any other query.

~ Shubham

1 Like

Hi @Amro_Alfadil,

In addition to @steevej-1495,

Before you reload the sample dataset, please delete the older ones otherwise you will get an error.

Let us know if you are still facing any issue.

~ Shubham

yes i deleted everything and re uploaded again and it works find seems 1 document i have modified it during the course and increased the count by 1. now the course is finished thank you very much looking forward for the next one.

Regards,
Amro