Posts

Showing posts from March, 2020

Mongodb

Image
Basic commands on mongo shell  Show all available databases:  show dbs;  Select a particular database to access, e.g. mydb. This will create mydb if it does not already exist:   use mydb;  Show all collections in the database (be sure to select one first, see above):  show collections;  Show all functions that can be used with the database:  db.my db.help();  To check your currently selected database,use the command db  > db  mydb db.dropDatabase() command is us ed to drop a existing database.  db.dropDatabase() insert collection  We add tworecords to our collection test as: >db.test.insert({"key":"value1","key2":"Val2","key3":"val3"})  WriteResult({ "nInserted" : 1 }) > db.test.insert({"key":"value2","key2":"Val21","key3":"val31"})  WriteResult({ "nInserted" : 1 })  If we see them via find, they will look very

Mongodb install & uninstall

Image
   MongoDB is an open-sourc e document database and leading NoSQL database. MongoDB is written in C++. This tutorial will give you great understanding on MongoDB concepts needed to create and deploy a highly scalable and performance-oriented database. Explanation:  This operation executes the index.js script in a mongo shell that connects to the mydb database on the mongod instance accessible via the localhost interface on port 27017. localhost:27017 is not mandatory as this is the default port mongodb uses. Also, you can run a .js file from within mongo console.  >load("index.js") install the mongo db in Terminal(ubundu 16.04) Step 1: Import the public key used by the package management system.  sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5 Step 2: Create a list file for MongoDB. echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse