MongoDB Shell Commands 1. Get List of database Command: show dbs 2. Get current database name Command: db 3. Switch to another database Command: use database_name Example: use testdb 4. Create new table command: db.createCollection(‘table_name’) Example: db.createCollection(‘tbl_user’) 5. Get List of table Command: show collections 6. Insert record in table ( command : db.table_name.insert( {key:”value”,….} […]

May
23
2018

 MongoDB on Ubuntu Installation steps : Step 1. Import the public key used by the package management system. The Ubuntu package management tools (i.e. dpkg and apt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. Command: sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5 Step 2. Create a /etc/apt/sources.list.d/mongodb-enterprise.list file […]

May
23
2018