I have about 500k records in my MongoDB, and I have to update every document with one flag
My query goes like this:
db.table.updateMany(
{},
{
$set: {
my_custom_flag: 1
}
}
);
But there are few documents which are more than 16MB, and I'm not able to update those documents due to MongoDB 16MB limitation.
The above query throws an error, and breaks the entire operation i.e. I cannot update the rest of documents.
Is there any way where I can suppress the errors and continue with the operation ? or I get the document _id of documents which are more than 16MB ?
{
"message": "Resulting document after update is larger than 16777216",
"name": "WriteError",
"code": 17419,
"index": 0,
"errmsg": "Resulting document after update is larger than 16777216"
}
EDIT: bulkWrite()
when used with ordered: false
still throws out same error, where other documents are not updated.
I don't understand why this question is marked as duplicate.
P.S: I do not wish to use GridFS