Simple annotation: MONGOs routing process, application access MONGOs query to specific fragmentation, listening port default 27017 config Server routing table service, each with all chunk routing information shard for data storage fragmentation,
A connection pool is implemented within the 1.Mongo object. The MONGO object is thread-safe, so you can only create one and use it securely in a multithreaded environment. Therefore, we can use the MONGO variable as a member variable of a singleton
MongoDB as a non relational database (NOSQL), it can be composed of the following structure, documents, collections, databases.
The basic unit of MongoDB is the document, which is similar to a row in a relational database, but from the bottom up,
Overview and installation of MongoDB
Basic Knowledge start the Wiredtiger engine
Creating a database
Use {dbname} to view all current databases
Show DBSPS: If the use of the database is empty, can not be displayed through the show DBS Check
MongoDB No-mode benefits
1, storage form, compared to the traditional relational database, it can use a table to store the original need to use a multiple table association to store the database. 2, storage dynamic, compared to the traditional
Click to open the link
the opening of the MongoDB Default startup:$./mongodbDefault data Save path:/data/db/default port: 27017 To Modify the default path: --dbpath $./mongdb--dbpath/mongodb/points The data storage location to a directory of its
First, prepare
First in Google or Baidu search "MongoDB", into the official website (https://www.mongodb.com/) to download.
second, the installation
Select a custom configuration and enter the installation path.
The installation path C:\Program
MongoDB Introduction
MongoDB is a document-oriented, open source database program that has nothing to do with the platform. MongoDB like some other NoSQL database (but not all.) Uses a JSON-structured document to store data. This is a schema that
double[] loc = new double[2];//coordinates [longitude, latitude]
loc[0] = 114d;//longitude
loc[1] = 118d;//
latitude DBObject near = new Basicdbobject ();
Near.put ("$near", loc);//indicates near query, unit is "degree"
near.put ("$maxDistance", );//
Switch to a database using use, db. Table name. Command name ({parameter}) to perform related actions. At this point the DB refers to the default switch to the DB
Lookup is usually the entire document, you need to get to a field in the document,
Document at address: http://download.csdn.net/detail/wyqlxy/3999890
MongoDB is a document-type database, not a relational database. The basic idea is to replace the original "line" concept with a more flexible "document" model. A document-oriented
I. Indexing operation
Indexes are born to optimize query speed, MongoDB indexes are almost identical to other relational databases, such as Mysql,oracle, and their index optimization experiences apply to MongoDB as well.
1. CREATE index
Indexing in
Classes that are @entity annotations must have a unique @Id value, which is stored in the id attribute of the MongoDB database, which is a required index. Like in the Hotel class:
@Entity
public class hotel{
@Id
Private ObjectId ID;
.....
}
Directly on the code
java.util.list mongohostlist = new arraylist ();
Mongohostlist.add (New ServerAddress ("192.168.1.102", 27017));
Mongo mg = new Mongo (mongohostlist);
DB db = Mg.getdb ("recommend");
if (!db.authenticate ("Jianp", "1
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
Above: http://blog.csdn.net/u013205877/article/details/75957573Pymongo is a low-level MongoDB python drive (which I call a client) that encapsulates the MongoDB API and communicates with MongoDB via JSON, Pymongo maps MongoDB data into Python's
operation of the index
The work of database 80% is basically a query, and the index can help us to query the desired data more quickly. But it reduces the write speed of the data, so it is necessary to weigh the common query fields without having
Transferred from: http://blog.csdn.net/mniwc/article/details/8465584
indexes can often greatly improve the efficiency of queries. When you use queries in your system, you should consider establishing related indexes. Creating an index in MongoDB is
In MongoDB, the concept of ' table ' in the corresponding relational database is ' set ', the data structure in the table is consistent, MongoDB is stored in JSON format, the collection data is flexible, and the same set of MongoDB collection can
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.