Skip to content

Instantly share code, notes, and snippets.

  • 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.
db.zips.find({
              $nor: [
                { pop: { $gt": 1000000 } },
                { pop: { $lt: 5000 } }
              ]
 }).count()

Basic

  • Connect to mongo:
mongo "<Atlas Cluster URI>"
  • List all databases:
show db

Import database:

  • JSON:
mongoimport --uri "<Atlas Cluster URI>"
            --drop=<filename>.json
  • BSON:
mongorestore --uri ""