Original: https://ruby-china.org/topics/20128MongoDB is the hottest NoSQL document database of all time, offering some great features: automatic failover, automatic sharding, modeless schemaless, and, in most cases, great performance. But mint in
Insert Document:Db.foo.insert ({"Key": "Value"});Inserting a data using insert will automatically add _id to the document if no _id is in the document.Batchinsert (array) BULK INSERT, accept a document array to do parameters.Use BULK Insert maximum
To learn more about how MongoDB stores data, one concept must be clear, and that is memeory-mapped Files. memeory-mapped Files shows how the database deals with the underlying system.
the memory-mapped file is OS via mmap Create a data
Before using MongoDB without setting users and permissions, the native application is always connected to MongoDB. The database connection port is not open after deployment on the server, and the native application connects to open the
When MongoDB is inserting or updating data, if a sudden power outage or irreversible devastating event occurs, MongoDB does not provide a mechanism for a relational database like Oracle or SQL Server, so it generates garbage data. But MongoDB
RS is a global variable that contains auxiliary functions related to replication, most of which are simply wrappers for database commands, such as>db.admincommand ({"replsetinitiate": config})Just and>rs.initiate (config)Commands are equivalent, but
In the MongoDB configuration file configuration described how to configure, here we are using the configuration file for Master/slave configuration implementation of Master-slave replication:First, the configuration of the master-slave server:1.
backgroundMapReduce is a very flexible and powerful data aggregation tool. The advantage of this is that a single aggregation task can be decomposed into several small tasks that are assigned to parallel processing on multiple servers.MongoDB also
Installing MongoDBsudo apt-get install MongoDBsudo apt-get install MongoDBClose/Startsudo service MongoDB stopsudo service MongoDB startTo set the database connection password: Creating a folder with directory: data/db Close the existing
Query.all ("name","a","b");//to match an array with multiple elementsquery.in ("name","a","b");//includes all values specified, you can specify different types of conditions and valuesQuery.and (Query.eq ("name","a"), Query.eq
1. Download the websiteAddress: Http://www.mongodb.org/downloadsMONGODB-LINUX-X86_64-2.4.9.TGZ (64 latest version so far)2. DecompressionSwitch to the download directory, command line input: Tar zxf mongodb-linux-x86_64-2.4.9.tgz3. Create database
Backup[Email protected] bin]#/mongodump-127.0.0.1 database:my_mongodb to dump/My_ MongoDB my_mongodb.system.indexes to dump/my_mongodb/system.indexes.bson 1 objects my_mongodb.user to dump/my_mongodb/user.bson
Mongdb's mapreduce is equivalent to "group by" in MySQL, so it's easy to use map/reduce for parallel "stats" on MongoDB.Using MapReduce to implement the two function map functions and the reduce function, the map function calls emit (Key,value),
LandingMONGO 192.168.0.134:27017
View GalleryShow DBS
Building a libraryUse testDb.createcollections ("command")
To view a table in a libraryShow collections;
Insert statementDb.command.insert ({name: "SSH", decriptions: "This is login
Use the aggregation framework to transform and combine documents in a collection. Create a pipeline (pipeline) with multiple artifacts for processing a series of documents. These artifacts include:Filter (filtering)Projection (projecting)Grouping
Use the Ensureindex function to create an index of the collection.For collections, each index needs to be created once, and duplicate creation has no effect;> Show Collections System.indexes UsersThe index metadata of all the databases is stored in
Recently, because some project companies began to use MongoDB as a large number of data storage, through the network of a large number of resources themselves have mastered a set of feasible MongoDB cluster configuration process, MongoDB with
First, insertThe INSERT statement for MongoDB is in this format:db.collection.insert(document)Where documents are document data, collection is a collection of document data. If collection exists, the document is added to the collection directory,
Note: In the backup file directory selection, there is a condition that the file directory, no matter how deep, can only have one file, (that is, except for the backup file can only exist folder, this condition constrains its entire directory
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