MongoDB
command
line
is good for
POC and initial analysis
.
But users need a
programming
language
to interact with mongoDB.
Python
, a most widely used programming language, has an official driver called
Pymongo
using which a user can
interact
with MongoDB easily.
Using
P
yMongo
, users can perform various CRUD operations.
1.Create 2.Read 3.Update 4.Delete
PyMongo
can be installed using pip.
pip install pymongo
By using the below 2 lines a user
can easily
connect to mongoDB
import pymongo client = pymongo.MongoClient("mongodb://localhost:27017/")
A user can also
pass
a
username and password
while connecting to mongoDB.
import pymongo client = pymongo.MongoClient("mongodb://[username:password@]localhost:2701
Click to learn more