Good day all,
I have a set of documents which are hitting the BSON size limit due to the number of items in an array of Subdocuments. I'm trying to apply a new field to these subdocuments as part of a schema update but it's failing on these specific documents because the new field pushes the BSON size limit over.
What I want to do is effectively split the Document(s) in 'half' based on the array of subdocuments, so I would have Document1 (the original) with the array now containing (for example) subdocuments 1-2, and Document1B having the array containing 3-4.
Here is an example of the basic layout
{
"_id" : ObjectId("5f11d4c28663f32e940696e0"),
"DocumentId" : "0000001",
"Items" : [
{
"ItemId" : NumberInt(1),
"ItemType" : NumberInt(1),
"ClassType" : "1",
"Created" : ISODate("2012-03-13T11:13:22.000+0000"),
"LastUpdated" : ISODate("2020-03-12T15:52:39.000+0000")
},
{
"ItemId" : NumberInt(2),
"ItemType" : NumberInt(1),
"ClassType" : "1",
"Created" : ISODate("2012-03-13T11:13:22.000+0000"),
"LastUpdated" : ISODate("2020-03-12T15:52:39.000+0000")
},
{
"ItemId" : NumberInt(3),
"ItemType" : NumberInt(1),
"ClassType" : "1",
"Created" : ISODate("2012-03-13T11:13:22.000+0000"),
"LastUpdated" : ISODate("2020-03-12T15:52:39.000+0000")
},
{
"ItemId" : NumberInt(4),
"ItemType" : NumberInt(1),
"ClassType" : "1",
"Created" : ISODate("2012-03-13T11:13:22.000+0000"),
"LastUpdated" : ISODate("2020-03-12T15:52:39.000+0000")
},
],
"Priority" : NumberInt(0),
"Status" : NumberInt(3),
"FileChecksum" : "ca1fbd9c8e1669bcf4155657d3600fa4",
"CreatedBy" : "[email protected]",
"LastUpdatedBy" : null,
"AssignedBy" : "[email protected]",
"DeletedBy" : null,
"LastUpdated" : ISODate("2020-03-12T15:52:39.000+0000"),
"Created" : ISODate("2012-03-13T08:13:23.000+0000"),
"Assigned" : ISODate("2012-03-13T11:10:48.000+0000"),
"Completed" : ISODate("2012-03-13T11:13:22.000+0000"),
"DeletedDate" : null,
"AssignedTo" : "[email protected]",
"RejectionReason" : null,
"Deleted" : false,
"DeletionReason" : null
}