Help show helpshow DBS show database namesshow collections show collections in current databaseshow users show users in current databaseshow profile show most recent system. profile entries with time> = 1 msuse set curent database to dB. adduser
Here we will not describe what MongoDB is. It mainly solves the problem of storing large data volumes. You can search for the keyword "MongoDB.
Windows version:
1, download: http://www.mongodb.org/downloads
2, download the latest stable
Security
Version 2.0 supports the Authentication Mode in the sharding status.
Differences from sharding Configuration
Before Version 2.0, parts must run in a trusted security mode without clear security policies.
In the current version, the
Mongodb is a database server that runs on the frontend or backend and waits for a connection from a user. When you start mongodb, you will see something similar to the following:
~/$ ./mongod## some logging output#Tue Mar 9 11:15:43 waiting for
Verification command
Use this command to check whether a set is valid (no error) and obtain a lot of statistics.
This command scans the entire set and its indexes, and is slow on large datasets.
Operate from mongo shell:
> db.foo.validate(){"ns" :
Object IDs
Documents in mongodb must be identified by a unique keyword _ id.
_ Id field
Almost every mongodb document uses the _ id field as the first attribute (with some exceptions in the system set and Capacity Set (capped collection ). The _ id
The MongoDB set is essentially the name of a group of documents. You can think that they are basically equivalent to tables in relational databases.
Overview
A MongoDB collection is a collection of bson documents. These documents usually have the
When to use GridFS
A large number of files. GirdFS performs better than many file systems when processing large (several thousand) files.
Files uploaded by the user. When a user uploads a file, you may have a large number of files and want to
By default, ensureIndex () is a blocking operation, and all other operations in the database are paused until the index creation is complete. However, mongodb Versions later than or equal to Version 1.3.2 provide optional options for creating
Create an index in the background
By default, index creation will block other database operations. V1.3.2 and later provide the background index creation function.
Delete Index
Delete all indexes of a specified
Valid keyword name
The keywords in the document must follow the following two constraints during naming:
"$" Cannot be the first character of a keyword.
"." Characters cannot be used in keywords
Schema Design)
The Pattern Design in MongoDB is
MongoDB supports two-dimensional geographic information indexing. It is designed for location-based queries in the mind, such as "finding N places closest to my location ". It can also efficiently process additional query conditions, such as
Test condition: for Windows + MongoDB 1.8.2, insert the test data first: for (var I = 1; I 2 ;}}); group joins $ where to query db. test. group ({key: {age: true}, initial: {num: 0}, $ reduce: function (doc, prev) {prev. num ++}, condition :{$
Mongostat is a state detection tool that comes with mongdb. It is used in the command line. It will get the current running status of mongodb at a fixed interval and output it. If you find that the database suddenly slows down or has other problems,
Recently, php's mongo extension was used for data statistics and computation. One of the timestamp fields, precise to milliseconds, has a length of 13 BITs. However, it was originally stored as a string:
{ "_id" : ObjectId("504eea97e4b023cf38e34039")
Help show dbs show database names show collections in current database show users in current database show profile show most recent system. profile entries with time> = 1 ms use set curent database to db. addUser (username, password) db.
Mongodb
The following are running in service mode:
D: \ mongodb \ bin> mongod-port 2011 -- logpath D: \ db \ log.txt -- logappend -- dbpath D: \ db \ mongodb -- directoryperdb -- serviceName MDB -- install
1) start the Service net start MDB
2) There
Document directory
Internal Structure of MongoDB data files
Implement transactions in MongoDB
MongoDB Data Synchronization
Sharding Mechanism
Server role
The image in this article is from Ricky Ho's blog MongoDB Architecture. This is a very
I. Preface
This article mainly describes the data type BSON used by MongoDB, the transmission Protocol Mongo Wire Protocol used, and the internal structure of the MongoDB data file.Ii. BSON
BSON[Bee · sahn], short for Binary JSON, Is a
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.