Making my way through MongoDB University, steady as we go now

Logic operators and the implicit $and operator. I am a little stuck on this but probably due to lack of sleep. I will try again in the morning. I am very much enjoying my progression through and learning of how to make queries to my data though the mongo shell. It is fascinating to me. After some Star wars or Transformers, I may even look at it again tonight. Who knows. Just posting progress and keeping myself motivated and accountable. Thanks for helping with this forum!!
The portion I am working through and sure that I will figure out is indicated in the image below and the question at hand was stated as follows:
How many zips in the sample_training.zips dataset are neither over-populated nor under-populated?
In this case, we consider population of more than 1,000,000 to be over- populated and less than 5,000 to be under-populated.
:hope:

Hi @Jason_Nutt,

We admire your positive learning attitude, and we wish you Happy Learning :sparkles:

Here, we got you a little help with the above problem statement!! click only if you need one :blush:

> db.zips.find({ "pop": { "$gt": 5000, "$lt": 1000000 }}).count()
11193
> db.zips.find({"$and":[{ "pop": { "$gt": 5000, "$lt": 1000000 }}]}).count()
11193

In case you need any help, please feel free to reach out.

Best Regards,
Kushagra

2 Likes

Thanks so much for that @Kushagra_Kesav! Boy, I really was tired, I was trying to get all of the "pop"s that ARE over and underpopulated, instead of how the question reads. Thanks again. Much appreciated. :eyes: :sunny: :grinning_face_with_smiling_eyes: Hopefully some rest did me good to get back to it.

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.