First, download and install MongoDB
MongoDB Download website link:http://www.mongodb.org/downloads
Specific installation Steps Tutorial:http://www.shouce.ren/api/view/a/6191(PS: The link to the MongoDB installation explanation is more detailed and easy to understand. Installation Tutorial link is I found from the manual online, the following summary of knowledge points is also I learn from the part of the induction, interested students may wish to collect ~)
Second,MongoDB visualization tool download
It is customary to perform command operations in a graphical interface, so that after installation after MongoDB, I was in the way to find a mongodb Visualizer installation to use. MongoDB Visualizer is much more, find mongobooster This visualization tool is more popular by finding online related blogs and posts .
Mongobooster official website download link:http://mongobooster.com/downloads(remember when downloading from official website, internet speed is very slow, Attached below a I then downloaded a version of the Baidu Cloud link)
Mongobooster Baidu Cloud Link:http://pan.baidu.com/s/1jIhnwVW Password:wgxw
Mongobooster After the installation of the specific interface (PS: and the use of MySQL -related visualizer very much like, with very good):
Three, the basic concept of MongoDB and the difference between the relational data
MongoDB Database Basic concepts:
relational database |
Mongodb |
database (db) |
database (db) |
Table(Tables) |
Collection ( collection ) |
Row ( row ) |
document (documentation) |
column (columns) |
Filed ( domain ) |
Index(indexed) |
Index(indexed) |
Table joins ( tables Relationship ) |
No |
Primary KEY ( primary key ) |
Automatically set the _id field as the primary key |
data types commonly used by MongoDB:
Data type |
Describe |
String |
String, the data type used to store data, UTF-8 encoding is legal in MongoDB |
Integer |
Integer value, used to store the value, according to the server you use, can be divided into three or Four |
Boolen |
Boolean value for storing Boolean values (True / false) |
Double |
Double-precision floating-point value for storing floating-point values |
Min/max keys |
A valuethat is relative to the lowest and highest values of the Bson(binary JSON) Element |
Arrays |
Used to store an array or list or multiple values as a key |
Timestamp |
Timestamp, recording when the document was modified or added |
Object |
For inline documents |
Null |
Used to create a null value |
Symbol |
Symbol. The data type is basically the same as the string type, but the difference is that it is typically used in languages with special symbol types |
Date |
Date time, in Unix time format, to store the current date or time. You can specify your own datetime: Create A Date object, pass in month and day information |
Object ID |
Object ID, which is used to create the document ID |
Binary Data |
Binary data for storing binary data |
Code |
Code type, used to store JavaScript code in a document |
Regular expression |
Regular expression type, used to store regular expressions |
Mogodb Common operation commands:
1. Create a database:use db_name (for example: Uselibrary, create a database with database name as Library )
2. View all databases of the system:show DBS
3, Delete the database: First use the specific database, using the command use db_name (PS: the command will not create a database under the Db_name database condition, no re-create a Db_name Database ), and then use the command db.dropdatabase () command
4. inserting documents:Db.collection_name.insert (document)
5. View Document:Db.collection_name.find ()
6. Update Document:db.collection_name.update (<query>,<update>,{upsert:<boolen>,multi:<boolen >,writeconcern:<boolen>})
7. Delete Document:Db.collection_name.remove (<query>,<justOne>)
the MongoDB action statement corresponds to a relational SQL statement against the table:
Operation |
Format |
Example |
similar statements in an RDBMS |
Equals |
{<key>:<value>} |
Db.col.find ({"By": " Rookie tutorial "}). Pretty () |
where by = ' Rookie tutorial ' |
Less than |
{<key>:{$lt: <value>}} |
Db.col.find ({"likes": {$lt:). Pretty () |
Where likes < 50 |
Less than or equal to |
{<key>:{$lte: <value>}} |
Db.col.find ({"likes": {$lte:). Pretty () |
where likes <= 50 |
Greater than |
{<key>:{$gt: <value>}} |
Db.col.find ({"likes": {$gt:). Pretty () |
where likes > 50 |
Greater than or equal to |
{<key>:{$gte: <value>}} |
Db.col.find ({"likes": {$gte:). Pretty () |
where likes >= 50 |
Not equal to |
{<key>:{$ne: <value>}} |
Db.col.find ({"likes": {$ne:). Pretty () |
where likes! = 50 |
MongoDB Learning Notes (ii: Introduction Environment Configuration and the relationship between the database and the summary)