Clarification of MongoDB Explanations

Having examined the use of private collections using MongoDB, the question came to the following statement:

"You can update documents in the collection after inserting them. However, these updates cannot cause the documents to grow. If the update operation causes the document to exceed its original size, the update operation will fail."

Thus, this in itself sounds reasonable, if not fully explain the reasons. And this makes me think: "If I do not want the document to grow, but maybe add additional information (that is: $ push to the array), then what would be wrong with filling out the document to my expected size."

So, my assumption sounds reasonable (for me one way or another), right up to reading this fragment from the FAQ on filling out .

Warning . Do not manually upload documents to a limited collection. Applying the manual adding to a document in a closed collection can result in replication failure. Also, the padding is not saved if you re-synchronize the MongoDB instance.

And again, this raises my question: "Why is this so?" Or specifically:

  • Why was filling out a document in a closed collection in this tearing replication?

  • Is there a missing section of the documentation showing obvious reasons for this? Or is it just “Dark Magic” in a closed collection of internal work at work? (Probably related to the "fill is not saved" part)

  • , , ? ( , ).

, - , .

P.S , , , .

+3
1

" "?

, (. DOCS-1528) . MongoDB , padding_foobar " " , ,

caveat : MongoDB , , , .

(. , , , , , ):

// 1. insert w/ 20 bytes of 'content'
insert({"name" : "john", "pad" : "0000000000000000"});

// 2. now we're performing an update, removing 16 bytes of padding, adding
//    3 bytes so we now have 7 bytes of 'content'
update({"name" : "john"}, {$unset: {"pad": 1}, $set: {"foo" : "bar"}});

// 3. at this point, we can easily grow the document again, as long as it doesn't
//    grow past its original size of 20 bytes of content
update({"name" : "john"}, {$set: {"foo" : "barfoobar"}});

, 2), , 7 " ". 3) , " " , .

, , . , , (, , -), .

+2

All Articles