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