1, download the latest MongoDB from the official website, choose Linux, and then according to their own Linux system to choose the appropriate version.
2, unzip the download of the MongoDB tar bag
After decompression, the main running scripts are
Overview
The MONGODB environment mainly includes standalone,replication and sharding. StandAlone: Stand-alone environment, the general development of the test when used. Replication: Master-slave structure, a primary, multiple secondary, there may
Db.createuser (
{
User: "Admin",
PWD: "Admin",
Roles: [{role: "root", DB: "admin"}]
}
);
The role can be changed to root, __system should be more.
Db.serverstatus (). connections
MongoDB role Database User role built in database role : Read,
DBObject o= (dbobject) Json.parse ("{groups.groupname: ' group1 '}");
DBObject o2= (dbobject) Json.parse ("{groups.size:0}");
This extra part is filed selection, for 0 you see the result inside there is no this filed, if 1 is only this filed is
MongoDB is a kind of nosql data, how can realize the group function in relational database.
Group
note:currently one must use Map/reduce instead the group () in Sharded MongoDB.
Group returns an array of grouped items. The command is similar to
These two days a simple study of the MongoDB database, belong to the NoSQL type database, a simple macroscopic look at NoSQL knowledge and MongoDB basic knowledge.
NoSQL is not just SQL abbreviation, it refers to the relational database, which is
Simple Master-slave replication
Using a master-slave or a master-slave mode, you can separate read and write, improve the availability of the database, but MongoDB's master-slave mode is not able to replace the master node after the failure
In fact, I always want to tidy up the MongoDB database I often use some operations command, finally have time ~MongoDB is an open source, free, non-relational database (NOSQL) with no tables, no records, and some differences from the usual
The index information is stored in system. indexes.
Create an index:DB. c1.ensureindex ({age: 1 },{ Background: true })1: ascending-1: DescendingBackground: whether to create an index in the background
Query the index of a tableDB. c1.getindexes ()
MongoDB comes with a distributed file system gridfs, which stores files in blocks. Generally, the storage is sufficient, one example in China is that visual China uses it to store images of hundreds of millions of data. It can be seen that this file
This document describes how to install MongoDB on 64-bit centos. MongoDB is a document-oriented database developed in C ++, which is designed in an anti-traditional database paradigm and records related objects in one document, each document
(1) Description of the Master/Slave copy lock section on the MongoDB Official WebsiteHow Does concurrency affect a replica Set primary?
In replication, when MongoDB writes to a collection on the primary,MongoDB also writes to the primary's oplog,
I. Glossary
1.doc ument is the basic unit of data in MongoDB. It is very similar to rows in the relational database management system (but more complex than rows ).
2. collection can be viewed as a table without a schema.
3. A single MongoDB
For the MongoDB Java driver, after 2.10.0, the document reminds that the Mongo class will be abolished and the mongoclient class is encouraged at the beginning.
The following shows how a Java program uses the latest mongoclient class to write data
This type of problem is often encountered. Now I will summarize the code I have written in the past two years, which will be much more convenient for programming in the future.
Document contains two arrays, a simple point. Each element is a string,
Driver package download: https://github.com/mongodb/mongo-java-driver/downloadsI downloaded mongo-2.8.0.jar-Version 2.8.0Open Mongo shell -- create database test -- (use test)Open eclipse new project, import JUnit, mongo-2.8.0.jar.The new test class
I. Preliminary understanding
MongoDB is a distributed file storage-based database. Written in C ++. It is designed to provide scalable, high-performance data storage solutions for Web applications. Nosql is one of the most successful nosql products.
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