Apsaradb for MongoDB in 8 days-getting started on the first day
Learn MongoDB in 8 days-add, delete, query, and modify in the next day
8 days to learn MongoDB-advanced operations on the third day
Apsaradb for MongoDB-index operation on the
Someone asked
In SQL: Select sum (price) from ordersin Mongo: DB. users. aggregate ([{$ group: {_ ID: NULL, total: {$ sum: "$ price" }}]) in SQL: Select sum (price) from ordershaving sum (price)> 10 in Mongo :?
Mapreduce can be implemented, but
1) install Python-devel. If Python-devel is not installed, an alert will be reported when pymongo is installed.
Warning: The pymongo. _ cmessage extension module cocould notbe compiled. no C extensions are essential for pymongo to run, although
The following describes how to execute a JS script using MongoDB:
./Mongo 10.1.18.181: 12000/xmail_db test. js
The content of test. JS is as follows:
VaR cursor = dB. getcollectionnames (); // get the collection nameFor (I = 0; I {// Printjson
When you deploy a MongoDB cluster (replica set), the Key File Permission fails. the startup parameters are as follows:
Mongod -- replset RS1 -- Keyfile/data/K0 -- fork -- Port 27017 -- dbpath/data/rs0 -- logpath =/data/log/r0.log -- logappend
Traditional relational databases are used in the past, but nowProgramThe requirement is getting higher and higher, and the data volume is getting bigger and bigger, regardless of the program or database requirements are getting higher and higher.
In the previous section, we have explained some understanding and concepts of MongoDB, so we will step into MongoDB learning.
Unlike apsaradb for MongoDB, which has powerful GUI clients, apsaradb for MongoDB also has powerful functions and stability,
A cluster consists of the following three services:
Shards server: each shard is composed of one or more mongod processes used to store data.
Config server: used to store the metadata information of a cluster, including the information of each
To put it simply:
MongoDB is a document-oriented database system. It is written in C ++ and does not support SQL
Use bson as the data storage and transmission format. Bson is a JSON-like binary serialization document that supports nested objects and
After reading some information, I only need to know how to query and use MongoDB. This is enough.
On the left is the MongoDB query statement, and on the right is the SQL statement. It is easy to use.
DB. Users. Find () Select * from users
DB. Users.
This article uses three MongoDB servers to set up replica-set.
First, prepare three Ubuntu VMS with MongoDB instance installed.
Then, the/etc/hosts of each VM contains the IP address and Host Name of the other two VMS.
This ensures that each VM can
Assuming that you already have MongoDB server and work on Ubuntu and install GCC, the following C ++ program can help you quickly enter the state where you can use MongoDB.
#include #include using namespace std;using namespace mongo;void SaveStatus(
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,
This is the automatic deployment of the standalone version. For manual deployment, refer to my other article:
Http://blog.csdn.net/sheismylife/article/details/6737127
First download the mongodb-linux-x86_64-2.2.0.tgz, decompress it and put it under
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. node types
Standard: a regular node that stores a complete copy of data and participates in voting. It may become an active node.
Passive: stores complete data copies and participates in voting. It cannot be an active node.
Arbiter: An
1) download MongoDBHttp://downloads.mongodb.org/win32/mongodb-win32-i386-2.0.4.zip
2) set the MongoDB directory
Decompress it to D: \ and rename it to MongoDB. The path is D: \ MongoDB.
3) set the data file path
Create a data folder in D: disk and
MongoDB has many advantages, such as multi-column indexes. Some statistical functions can be used for queries and multi-condition queries are supported. However, multi-table queries are not currently supported, you can try to solve the problem of
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.