Created
March 18, 2017 13:37
-
-
Save shrawanx/6a4d73ada564d87703c04034b217e412 to your computer and use it in GitHub Desktop.
Mongodb basic usuage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service mongod start | |
service mongod stop | |
service mongod restart | |
show dbs --->will show all database | |
use [database name]---->will use the db | |
db.dropDatabase() ---> will drop database of selected database or else test db is deleted | |
db.createCollection([collection_name])---->will create a new collection | |
show collections ----> will show all collection inside the database | |
db.[collection_name].drop()------>will drop the collection | |
db.COLLECTION_NAME.insert(document)---->will insert document in collection | |
db.COLLECTION_NAME.find()---> finding document | |
db.COLLECTION_NAME.find().pretty()---->show result in formatted order | |
>db.COLLECTION_NAME.update(SELECTION_CRITERIA, UPDATED_DATA)-->updating | |
>db.COLLECTION_NAME.remove(DELLETION_CRITTERIA)-->deleting document | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment