Вы находитесь на странице: 1из 19

MongoDB ( .

humongous )
-
() ,
C++.
MongoDB, ,

- (
) (
).
-: 10gen

-:

MailBox(DropBox)

C, ++, #

LinkedIn

Java

github

Erlang

CERN

Ruby

Windows Azure

PHP

...

Perl

Pyton

,

,


XML
XML:

<?xml version="1.0"?>
<!-- Comment -->
<PRODUCTS>
<PRODUCT id = 0>
<TITLE> Product #1 </TITLE>
<PRICE> 10.00 </PRICE>
</PRODUCT>
<PRODUCT id =1>
<TITLE> Product #2 </TITLE>
<PRICE> 20.00 </PRICE>
</PRODUCT>
</PRODUCTS>


JSON

JSON:

"firstName": "",
"lastName": "",
"address": {
"streetAddress": " ., 101, .101",
"city": "",
"postalCode": 101101
},
"phoneNumbers": [
"812 123-1234",
"916 123-4567"
]

:
:.

, ,
, , -,

.

,
.


BSON

BSON - Binary JSON,




.

JSON,
,
.

BSON ()

.
,
.

:
string
int
double

DateTime
byte[] ( )
bool ( )
null ( )
BsonObject BSON
BsonObject[] BSON

:
{"hello": "world"}

"\x16\x00\x00\x00\x02hello\x00
\x06\x00\x00\x00world\x00\x00"

MongoDB ,
JSON-

BSON
-.
BSON,
,

- 16MB



MongoDB,

.




,


ReplicaSet

Mongod

MongoDB.
,

2
:

Master-Slave

ReplicaSet


ReplicaSet

ReplicaSet MongoDB mongod


,

ReplicaSet :

Primary:
(oplog)

Secondaries:
Primary .
(nonvoting)

Arbiter: ,

12 mongod
,
3: Primary 2 Secondaries


ReplicaSet




Primary

Arbiter
Primary .


Sharding.

Sharding
,
,

,

Sharded Cluster:

MongoDB(mongod
ReplicaSet)

(mongod)

(mongos)


Sharding.

MongoDB

shard key ,

shard key
(chunk)

,
, Shard'
2
chunk':

Range Based Sharding

Hash Based Sharding


Sharding. Balanced Data Distribution

Splitting
,

Balancing -
chunk'
shard'


Write operations


:
db.collection.insert()


:
db.collection.update()


:
db.collection.remove()


Read operations

db.collection.find()

$gt, $gte, $lt, $lte

db.collection.findOne()

$in, $ne,$nin

.limit(), .skip(), .sort()

Вам также может понравиться