The download and installation of MongoDB

Source: Internet
Author: User
Tags mongoclient mongodb robomongo

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.