MongoDB CheetSheet [In Progress]

This guide includes an introduction to MongoDB, a glossary of terms and lists of commonly used MongoDB commands with example.
So here we go, 


  1. Mongodb is a non-relational database which means it does not use the tabular schema of rows and columns found in most traditional database systems like MySql. 
  2. The second thing about mongodb is that it stores data in a key-value pair. 
  3. The third thing about the mongodb is that the attribute _id which is unique and it is automatically created by Mongodb so chill  😎

MongoDB commands

  • Create Database:
    •   use <Database Name>
  • Create Collection: 
    • db.createCollection(<"Name">,{<Option>})
  • Insert One document in collection: 
    • db.<Collection-Name>.insertOne([{<document>}])
  • Insert Many Documnets in Collection: 
    • db.<Collection-Name>.insertMany([{<document1>},{<document2>}])
  • Find a particular row:
    • db.getCollection("<Collection-Name>").find({<column-name>:"<Unique Name/Id>"})
  • To check which db is selected:
    •  db
  • To check all databases who has at least one collection or document
    • showdbs
  • To drop a database:
    • db.dropDatabase()
  • To drop a collection in database:
    • db.<collection-name>.drop()
  • To see collection:
    • db.<collection-name>.find()
  • To check the version of mongodb:
    • db.version()


Popular posts from this blog

How to pass parameters in webhook?

Access and modify all the resources of our Wiki.js using WikiJS API

Fahrenheit to Celsius