MongoDB is a large data environment for the birth of a large amount of data to save the relational database, for a large number of data, how to do statistical operations is very important, then how to count some data from the MongoDB?
In MongoDB,
The destinct command for MongoDB is to get a list of different values in a particular field. This command applies to normal fields, array fields, and arrays of embedded documents.
MongoDB's distinct statement:
Copy Code code as follows:
Increase Arbiter
Add the profile mongod1,mongod2,mongod3 to the arbiter of Shard1,shard2,shard3 three set sets, respectively.
Copy Code code as follows:
Replset=shard1
Replset=shard2
Replset=shard3
Start the Mongod
Version One:
Field
Example Value
Explanation
Host
te.rzw.com:27018
The port that the running instance listens to
Version
1.8.3
Version used by the current instance
Process
The example in this article describes the Scrapy custom pipeline class implementation method that saves data collected to MongoDB. Share to everyone for your reference. as follows:
# Standard Python Library Imports # 3rd party modules
Starting mode./bin/mongod-f mongodb.conf'll seeAbout-to-fork child process, waiting until server was ready for connections.Forked process:2313Child process started successfully, parent exitingBasic Configuration#数据库数据存放目录Dbpath=/usr/local/mongodb304/
Tool Download: Https://robomongo.org/downloadFinal effect:That is, we can directly see all data linked to the 27017 port data, and it can be effective additions and deletions to check and change. Note that when downloading the software, we can see
We should first know the data structure of MongoDB: MongoDB: Library----Collection-->json ObjectViewShow DBS//See which libraries are availableShow collections//See which collections are in the libraryLibrary operationsUse library name//using a
1. Download MongoDBThe default is 64-bit, this is a bit awkward ...64-bit system: https://www.mongodb.org/dl/linux/x86_64-debian81?_ga=2.15324022.1713724367.1498550277-1089294971.149855027732-bit Download list address:
$gt -->
$lt --
$gte -->=
$lte --
$all is similar to in, the difference is that all the values in [] must be met
$exists Field exists Db.sun.find ({"Age": {"$exists": True}}) queries for data that has an age field, null field
I. The concept of read and write separation Read and write separation, the basic principle is to let the main database processing transaction increment, change, delete operation (INSERT, UPDATE, delete), and from the database processing select
First, the importance of MongoDB security checkThe database in each MongoDB instance can have many users. If the security check is not enabled and the user is restricted, each user who enters the database can read, write, or even write to the
Connect MongoDB first by connecting the database with the MONGO shell:Switch to the MongoDB directory#cd/mongodb/binInput Port Login MongoDB#./mongo--port=27017#切换到admin用户下 (You must switch to this user, otherwise you will not be able to do the
first, start MongoDB in a non-authoritative mode.Non-authorized:Linux/mac:mongod-f/mongodb/etc/mongo.confWindows:mongod--config c:\mongodb\etc\mongo.conf or net start MongoDB (provided MONGO is installed in the service)Note:/mongodb/etc/mongo.conf
MongoDB do cluster, version 3.2 of the recommended cluster mode replica set preparation server 3 two standard node (these two nodes directly can be mutually primary secondary). A arbiter node, holding a ballot in its hand, determines which of the
A complete example of building a MongoDB cluster (replica set + Shard) ...Prepare four machines, each bluejoe1,bluejoe2,bluejoe3, and BLUEJOE0The replica set and the Shard policy determine such as the following:
3 replica sets will be
Install MongoDB under Mac1. Download mongodb-osx-x86_64-3.4.1.tgz and unzip the Https://www.mongodb.com/download-center on the MongoDB website.2.Enter the extracted bin directoryfengnovodemacbook-pro:~ fengnovo$
MongoDB replica Set Maintenance main work:1. View replica set status (cluster status, synchronization delay, single library run status Mongostate)2, delete nodes, stop node shutdownMongoDB replica set cluster synchronization mechanism
The
1. Download the latest stable version of the installation package.[Email protected] mongodb]$ wget-c--no-check-certificate https://fossies.org/linux/misc/mongodb-linux-x86_64-3.2.11.tgz2. Unzip the installation package.3. Set environment
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