First, the opening analysis
This is an extended knowledge article, because database operations are used in the following articles, so today it is said (MongoDB module).
(1), introduction
MongoDB is a database based on distributed file storage.
The compilation of PHP MONGO module
To download the current stable stable version from Http://pecl.php.net/package/mongo, the latest stable release is 1.5.2 and the installation steps are as follows:
The code is as follows
Copy
First step, install MongoDB to each server
Prepare more than 3 MongoDB servers and do the following on each platform
1, download MongoDB, extract and move to/usr/local/mongodb directory(if wget is not installed, please yum install wget or apt-get
MongoDB is an open-source non-sql database engine. MongoDB is extensible and is a substitute for standard relational database management systems (RDBMS). A replica set can also provide access to your data when a node fails.
Install MongoDB
1.
MongoDB is a database based on distributed file storage. Written by the C + + language. Designed to provide scalable, high-performance data storage solutions for WEB applications.
MongoDB is a product between relational database and non relational
GROUP BY date Aggregate query date statistics daily data (amount of information)1
{
"_id": ObjectId ("557ac1e2153c43c320393d9d"),
"Msgtype": "Text",
"Sendtime": Isodate ("2015-06-12t11 : 26:26.000z ")
}
2
{
"_id":
Simple additions and deletions to check the data
Specify the display in the query results or do not display a field
For example, we want to find all the data in the lessons collection, but we don't want to include the Slides field in the return
For example, if you want to create a "myTest" database, run the use MyTest command, and then do something (such as db.createcollection (' user '), so you can create a database called "myTest."First, the database commonly used commands1. Help View
Traditional relational databases are generally composed of three levels of databases (database), tables (table), records (record), and MongoDB are made up of three levels (db), Collections (collection), document objects (documents). MongoDB for
First, the index base:
MongoDB's index is almost exactly the same as the traditional relational database, which includes some basic optimization techniques. Here is the command to create the index:
Copy Code code as follows:
>
Starting from this article, we mainly discuss the deployment technology of MongoDB.
We know that SQL Server can do read-write separation, dual-machine hot backup and cluster deployment, of course, MongoDB can do, in practice, we do not want the
Today, when I use MongoDB to manipulate aggregation, I want to format dates like "2013-10-17 04:41:37 UTC" into "October 17",
Copy Code code as follows:
' FDate ' => {' $concat ' => [' $date. Month ', ' month ', ' $date. Day ', ' th ']}
In MongoDB, the Db.collection.remove () method is used to delete documents from the document. You can delete all documents from a collection, delete all documents that match one condition, or restrict actions to delete only one document.
Delete all
The first attempt to connect to the MongoDB database today is a simple step.
First, install the MongoDB package through the Nodejs running environment, enter the directory to be installed, execute the statement
NPM install MongoDB After a
The example of this article describes the simple operation of Php MongoDB method. Share to everyone for your reference, specific as follows:
PHP operation MongoDB First download the MongoDB expansion pack from the Internet,
has been using the Ubuntu system for some time, because the use of the source installed MongoDB, so everything is configured by default, open the Shell Direct Input MONGO command can be used. Yesterday to the notebook installed a win10, ready to
There is a project using the MongoDB database, query conditions have and also, according to thinkphp official manual, using a composite query (_complex), Getlastsql output query statement, found that the query condition is empty. Query with string
In many cases, some slow queries cause pressure on MongoDB. It takes some time to write a script and kill slow queries. The code is as follows:Copy code Var j = 0;Var _ DEF_TIME = 10; // Set the slow query time.For (var I in db. currentOP ().
Only one cm database is migrated. The target database is version 2.4.8 and the original database is version 2.4.6. Therefore, hot backup is used for migration.The official document is very simple: The code is as follows:Copy code Mongodump-host
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.