This Repo contains example programs of pymongo( Database connectivity with MongoDB ).
-
Download MongoDB Server from MongoDB Download Center. Follow this URL :
-
Open Download folder double click on downloaded file to start installation.
Now Click on Next.
-
Accept terms & condition and click on Next.
-
Now Choose Setup Type.
Click on Complete
Click on Next
-
Now Choose the Service Configuration.
Check on Install MongoDB as a service.
Select Run Service as Network Service User.
Click on Next
-
Ready To Install MongoDB.
Click on Install
-
Wait for the completion of status.
Click Next
-
You have Complete the installation of MongoDB Server in Your Machine.
Click on Finish
-
Now you have to set Environmental Path.
Goto the dir on your system :
C:\Program Files\MongoDB\Server\4.2\bin\
-
Now open Edit the System Environmental Variable.
Click On Environmental Variables...
Edit Path
Add two Paths :
C:\Program Files\MongoDB\Server\4.2\bin\mongo
C:\Program Files\MongoDB\Server\4.2\bin\mongod
You have completed MongoDB Server in your Local Machine.
$ python -m pip install pymongo
-
Clone createDB.py
-
Replace URL in MongoClient
For Localhost
> "mongodb://localhost:27017/"
For MongoDB Atlas
> Replace with your Cluster srv > e.g. "mongodb+srv://<yourusername>:<yourpassword>@cluster0-mgbud.mongodb.net/test?retryWrites=true&w=majority"
-
To Create Database
Replace DbName with Your Database Name.
Replace collName with Your Database Collection Name.
Enter Data What You Want To Store In Database.
-
Run createDB.py
- https://api.mongodb.com/python/current/tutorial.html
- https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/
Hurray... You Have Successfully Created Database With pymongo in MongoDB.