I have a collection which has an array defined in the schema (Realm App). It is NOT a required field…
“imageServiceIds”: {
“bsonType”: “array”,
“items”: {
“bsonType”: “string”
}
},
Some of my documents have imageServiceIds defined with an array of strings, some do not have it defined at all. In the realm logs, I am getting the following error for those documents that do not have the array defined.
Failed to convert MongoDB document with configured schema during initial sync…Detailed Error: field update at path { table: "Item", fullPath: "imageServiceIds" } should have been an array value but was object
I should also note the collection name is “items” but the schema has a title of “Item” (not sure if its an issue or not).
How should I handle this scenario? I know I can ensure the underlying document has the field defined with an empty array but this won’t help me in the future when I want to add another array field and all the existing documents do not have it defined.
Thanks