> itemsA = { attrA : "vA", attrB : "vB" }
{ "attrA" : "vA", "attrB" : "vB" }
> db.collectionA.insert(itemsA)
> db.collectionA.find()
{ "_id" : ObjectId("4e85de174808245ad59cc83f"), "attrA" : "vA", "attrB" : "vB" }
> itemsA
{ "attrA" : "vA", "attrB" : "vB" }
> itemsB = { attrC : "vC", attrD : "vD" }
{ "attrC" : "vC", "attrD" : "vD" }
> db.collectionB.save(itemsB)
> db.collectionB.find()
{ "_id" : ObjectId("4e85de474808245ad59cc840"), "attrC" : "vC", "attrD" : "vD" }
> itemsB
{
"attrC" : "vC",
"attrD" : "vD",
"_id" : ObjectId("4e85de474808245ad59cc840")
}
Here is my observation:
After being inserted into collectionA, the value of itemsA is not modified.
In the contrast, after being stored into collectionB, the value of itemB is changed!
Is there any rule that guides those modifications so that I know what should be expected after a value is either inserted or saved into a collection?
Thank you