Installing MongoDB
When you are finished installing
New folder, configuring DBPath
Create a new Data folder under the MongoDB folder and create a new DB folder under the Data folder
Start the service
Install third-party visualizer
Robomongo
Https://robomongo.org/download
Open Robomongo
Click Create, and then test to succeed
Save
It's connected.
Open command line, enter show DBS, default Ctrl+enter run
Enter the database Hello and insert a piece of data
Db.dropdatabase () Delete the current database
Python connection MongoDB
fromPymongoImportmongoclientclient=mongoclient ()#Establish a connectionhello_db=client['Hello']#set up a databaseuser_collection=hello_db['User']#Get Collection#print (user_collection)User={ "name":"Xujunhao", " Age":" -", "Sex":"male"}user_id=user_collection.insert (user)#Insert DocumentPrint(user_id)#Print the contents of the primary key
fromPymongoImportMongoclient
Client=mongoclient ()#Establish a connection
hello_db=client[' Hello ']#set up a database
user_collection=hello_db[' user ']#Get Collection
# Print (user_collection)
user={
"Name":"Xujunhao",
"Age":" ",
"Sex":"Male"
}
User_id=user_collection.insert (user)#Insert Document
Print(user_id)#Print the contents of the primary key
The download and installation of MongoDB