MongoDB
is one of the most popular open-source, No-SQL,
document
-
based
databases.
MongoDB
commands follows
JSON
like structure. The 5 most widely used
Mongodb
commands are
Type the above command in terminal to connect to mongoDB shell
1. Connect to
Mongo shell
mongo
The above command will list the
databases
present
in MongoDB
2. List databases
show dbs
createcollection
command will
create
a
collection
name "
test
"
3. Create a
new collection
db.createCollection('test')
Insert
command will
insert
a document into the MongoDB
test
collection.
4. Insert Record into the mongo collection
db.test.insert({'Kind': 'Mobile','Brand': 'iphone 6s'})
The command will list
all documents
present in the Mongodb
test
collection
.
5. List all documents in a collection
db.test.find()
Click to learn more MongoDB commands