MongoDB field order and document position change after update -


i learning mongodb , noticed whenever update on document field being updated pushed end of order, if had like:

db.collection.save({field1: value1, field2: value2, ..., field 10: value10}); db.collection.update({field1: value1}, {$set: {field2: new_value}}); 

then if do:

db.collection.find(); 

it display:

{ "field1":"value1", ..., "field10":"value10", "field2":"new_value"} 

you can see how field order changes updated field being pushed end of document. in addition, document being pushed end of collectoin. know it's "schema-less" db , may not huge problem, doesn't "pretty" :). there way in-place update without changing order?

mongodb allocates space new document based on padding factor. if update increases size of document beyond size allocated document moved end of collection. same concept applies fields in document.


Comments

Popular posts from this blog

jQuery clickable div with working mailto link inside -

java - Getting corefrences with Standard corenlp package -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -