To improve query efficiency, MONGODB also provides indexes (like the index of relational databases, using B-tree storage), with a single field index, combination index, multiple key index (for array query), spatial index, text index, and hash index.
MongoDB Storage Engine
When it comes to MongoDB's metadata information, first introduce the storage category of MongoDB. mongoDB3.2.4 Support 5 kinds: Wiredtiger (default) MMAPv1 inmomery Encrypted 3rd party Engine metadata Information
From the
References: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/
The steps are as follows:
1. Download mongodb:http://www.mongodb.org/from the website
Because now 2.0 has been released, so here is the MongoDB 2.0.6
2. After
First, the principle of work
1. The MongoDB 2.6 version starts with the recommended replica set, which is no longer recommended for master-slave replication.
2. The replica set requires at least 3, can be 3 copies of all the replica set, you can
MongoDB set access rights, set user
MongoDB has been used for a long time, and MongoDB-based data storage has not been used to access permissions (MongoDB defaults to unrestricted access restrictions), today took a little time to study, the
The primary key is set by the comment "@Id", and MongoDB automatically generates the primary key if the primary key is not set.
Import Org.springframework.data.annotation.Id;
public static class ordercomsumedto{
@Id
private String OrderNo;
First, download and install MongoDB
1, official website download: https://www.mongodb.com/download-center#community
2. Installation
3, configure the path, as shown in the following image: Execute mongod.exe command, error "C:\data\db\ not
Basic Operation command Show DBS//View all libraries using test//Use library without words automatically create show collections//view created table add Db.test_collection.insert (); Key value pair JSON data for (i=3;iDb.test.find ({$text: {$search:
Today, a group of brothers asked me the MongoDB collection corresponding file is which, this problem I have not viewed, to the MySQL file is easy to distinguish the way to save, but MongoDB is not so, save the file as followsThe file name doesn't
MONGODB Multi-collection multi-table statistics combat
Complete the following reports:
Table person, Appointmentrecord number of people involved
Using aggregate functions in the person tableDb. Person.aggregate () on the line
[
{
$match: {
Transferred from: http://docs.mongoing.com/manual-zh/core/aggregation-pipeline-optimization.html
$skip + $limit order optimization
If you have a pipeline with $skip followed by a $limit, the optimizer moves the $limit to the front of the $skip, at
All data are not the same.
First look at skip and limit, when the two are used together, regardless of their position order, default first skip, then limit.
The following figure:
Look at the sort, "6" statement, my data is sorted. After that,
MongoDB implements MySQL auto_increment function
Refer to the official documentation (FINDANDMODIFY implementation):
1.Insert into the counters collection, the initial value for the UserID:
Db.counters.insert (
{
_id: "userid",
seq:0
The delete operation uses remove, the data is deleted and the query is similar, accept a parameter, and the query is different, in order to prevent misoperation, the delete operation does not allow the parameter is not passedLike
When the amount of data is low, the query is fast, but when the data is large, the query becomes very slow, in MongoDBView Index> db.test_collection.getIndexes ()[ { "V": 2, "key" : { "_id": 1 }, " Name ":"
1, download the corresponding jar package, here use Springboot to create the project, so the corresponding jar package will be loaded automatically2, connect the client, do not use authentication when the server starts up: /* connect the
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