I. MongoDB Introduction
MongoDB is a high-performance, open-source, and open-mode document-based database. It is currently the most popular nosql database product, it can be used in many scenarios to replace traditional relational databases or
1. 100 entries are generated
VaR A = new array (100); // There Is. foreach. I don't know why I can only use for (VAR I = 0; I CodeLine feed
Using dB. Test. Find (), you can see that the database has been imported into the database. Enter the it
1. Connection
The default MongoDB port is 27017. Therefore, we can connect to MongoDB: $ MongoDB = new Mongo ('localhost') or specify the IP address and port $ MongoDB = new Mongo ('192. 168.127.1: 27017 ') the port can be changed.
If MongoDB
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
The stringbuilder class in MongoDB code.
// stringdata.h/* Copyright 2010 10gen Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may
Document directory
2.1 normal unconditional Query
2.2.1 single-condition Query
The last short answer described the introduction of MongoDB. This article is about to enter the topic to record mangodb usage.
1. Add data to save
>
Generally, the ID field of a relational database is a self-increasing numeric type, but the _ id field of MongoDB is very strange. It can be unique, but it is not a simple type, not a number, it is not a string. I almost thought it was a string when
Http://www.xiaocai.name/emlog/post/35
MongoDB (http://www.mongodb.org) is a nosql document-type database management system, that is not a traditional relational database (similarOracle, MS-sqlserver, MySQL, etc ). In traditional relational databases,
MongoDB provides diverse index support. The index information is stored in system. indexes, and the index is always created for _ ID by default. Its Index usage is basically the same as that of relational databases such as MySQL. In fact, it can be
Reprinted from http://www.cnblogs.com/spnt/
Since MongoDB is used, it has to use its secure backup mechanism: replica set.
What is MongoDB replica set?
In general, multiple machines are used for asynchronous synchronization of the same data, so that
1. Download the installation packageWget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.8.2.tgz
Decompress the package after the download is complete.Tar zxf mongodb-linux-i686-1.8.2.tgz 2. Installation preparationMove MongoDB to the/usr/local/
Document directory
Download
Unzip and install
Create a data directory
Run and connect to the MongoDB Server
Further study
Original address: http://tq-zone.appspot.com/mongodb_quickstart_windows
Download
32-bit version
64-bit
DbrefIs a more formal specification for creating references between documents. dbrefs (generally) include a collection name as well as an object ID. Most developers only use dbrefs if the collection can change from oneDocument to the next. If your
BSONObjBuilder Q;Q.append("Name", str);auto_ptr cursor = conn.query("test".NewsContents", Q.obj());
The preceding statement can be used for query. Then, the conditions are appended.
The following lists several common statements:
1.
BSONObj test =
The previous article explains how to use MongoDB for replication, but I use BSON Object to save files. This limitation is that if the file size exceeds 4 MB, an exception occurs.
According to the official website,BSON objects in MongoDB are limited
Security
Version 2.0 supports the Authentication Mode in the sharding status.
Differences from sharding Configuration
Before Version 2.0, parts must run in a trusted security mode without clear security policies.
In the current version, the
Mongodb
The following are running in service mode:
D: \ mongodb \ bin> mongod-port 2011 -- logpath D: \ db \ log.txt -- logappend -- dbpath D: \ db \ mongodb -- directoryperdb -- serviceName MDB -- install
1) start the Service net start MDB
2) There
Query. All ("name", "a", "B"); // matches an array with multiple elements.
Query. And (Query. EQ ("name", "a"), Query. EQ ("title", "t"); // satisfy multiple conditions at the same time
Query. EQ ("name", "a"); // equal
Query. Exists ("type",
Document directory
Internal Structure of MongoDB data files
Implement transactions in MongoDB
MongoDB Data Synchronization
Sharding Mechanism
Server role
The image in this article is from Ricky Ho's blog MongoDB Architecture. This is a very
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