Visit:
https://www.mongodb.com/try/download/community
Download the Community Edition and Boom!
The rest process of installation in your local machine is easy-to-go. Then, Install:
MongoDB Shell or mongosh
Make sure that you have add the bin sources of Mongod and Mongosh into the path of your local machine's Environmental Variables.
Now, it's time to have fun! Your MongoDB is set to go!
Go to your Command Prompt!
use Employee
# Employee is a db_name
db.collection.insertOne(
{
firstname: "Al Amin",
lastname: "Ifty",
age: 26
})
That's how you can create a JSON file on the prompt. And it'll directly update the MongoDB server if the rest process is okay since installation.
Via Terminal:
pip install pymongo
Via Python File: (For Ex)
import pymongo
client = pymongo.MongoClient('mongodb://127.0.0.1:27017/')
mydb = client['Employee']
information = mydb.employeeinfo
record = {
"firstName": "Christiano",
"lastName": "Ronaldo",
"role": "Striker"
}
information.insert_one(record)