|
I just tested this in the shell and I can reproduce it just using insert command directly.
Updates are accepted as long as the type of the updated field is not being changed (whether it's getting bigger or smaller). But anything that changes the type of the field/size of document causes an error.
db.testbig.drop()
|
true
|
test@127.0.0.1:27017(3.6.0) > var doc={a:1, x:new Array(16*1024*1024-28).join('x')}
|
test@127.0.0.1:27017(3.6.0) > Object.bsonsize(doc)
|
16777211
|
test@127.0.0.1:27017(3.6.0) > db.runCommand({insert:"testbig", documents:[ doc ]})
|
{ "n" : 1, "ok" : 1 }
|
test@127.0.0.1:27017(3.6.0) > var docin=db.testbig.findOne();
|
test@127.0.0.1:27017(3.6.0) > Object.bsonsize(docin)
|
16777228
|
test@127.0.0.1:27017(3.6.0) > db.testbig.update({},{$inc:{a:1}})
|
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
|
test@127.0.0.1:27017(3.6.0) > db.testbig.update({},{$inc:{a:1}})
|
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
|
test@127.0.0.1:27017(3.6.0) > db.testbig.update({},{$inc:{a:1}})
|
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
|
test@127.0.0.1:27017(3.6.0) > db.testbig.update({},{$inc:{a:1}})
|
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
|
test@127.0.0.1:27017(3.6.0) > db.testbig.update({},{$set:{a:true}})
|
WriteResult({
|
"nMatched" : 0,
|
"nUpserted" : 0,
|
"nModified" : 0,
|
"writeError" : {
|
"code" : 17419,
|
"errmsg" : "Resulting document after update is larger than 16777216"
|
}
|
})
|
test@127.0.0.1:27017(3.6.0) > db.testbig.update({},{$unset:{a:1}})
|
WriteResult({
|
"nMatched" : 0,
|
"nUpserted" : 0,
|
"nModified" : 0,
|
"writeError" : {
|
"code" : 17419,
|
"errmsg" : "Resulting document after update is larger than 16777216"
|
}
|
})
|
|