Getting Started with MongoDB

Source: Internet
Author: User

Window Install binary Package http://www.mongodb.org/downloads

Create a new directory C:\data\db

Start service mongod--dbpath C:\data\db

Start the client (shell) MONGO

Basic concepts

SQL Terminology/Concepts MongoDB Terminology/Concepts Explanation/Description
Database Database Database
Table Collection Database Tables/Collections
Row Document Data record Line/document {Key:value}
Column Field Data fields/Fields
Index Index Index
Table joins Table connection, MongoDB not supported
Primary key Primary key Primary key, MongoDB automatically sets the _id field as the primary key

  

Database Operations (DB.HELP ())

Show DBS shows all databases

DB Displays the current database

Use TestDB switch to TESDBT database, no new TESTDB database

Db.dropdatabase () Delete the currently located database

Set operation (Db.mycoll.help ())

Show collections Display all collections

Db.createcollection (name, {size: ..., capped: ..., max: ...}) Create a Collection

Db.coll.insert ({' xx ': ' xx ',...}) Inserts a document into the Coll collection, coll does not exist the new

Db.coll.find () To view all the documents in the Coll Collection, find (m,n) can specify the number of queries, find (). Sort () can be connected to use, there are other. Size (),. Count () ...

Db.coll.drop () Delete Coll collection

Manipulating MongoDB with Python

Pip Install Pymongo

Import= Pymongo. Mongoclient ()   can pass parameters (' localhost ', 27017)  or  = client['testdb']     or   = db['posts')       or Db.postsposts.insert ({'xx  ':'xx', ...})   Posts.find ()     

Getting started with 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.