Skip to content

Instantly share code, notes, and snippets.

@mamun67
Created November 16, 2017 08:58
Show Gist options
  • Select an option

  • Save mamun67/35e28291bcf88861cd0bb165a4626fb5 to your computer and use it in GitHub Desktop.

Select an option

Save mamun67/35e28291bcf88861cd0bb165a4626fb5 to your computer and use it in GitHub Desktop.
MongoDB
To start MongoDB
->mongod --dbpath ../newdata //Path of the data folder
//To show available Db
->show dbs
//to create new db and use it
->use dbname //it will create the db if it doesnot exist
//to use a particular db
-> use dbname
//to enter data into mongodb collection
->db.collectionname.save({"data1":"test1","data2":"test2"})
//to find all record
->db.collectionname.find()
//to import data into collection
->mongoimport --db User --collection employee --file C:\Users\pmandawa\Desk
top\data.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment