Based on documentation on mixed data type, it is currently supported in Device Sync. E.g:
- Flutter SDK supports mixed data since version 2.0.0: flutter/data-types
- React Native SDK supports mixed data since version 10.5.0: react-native/mixed
But there is no mention of mix data type on the side of Data API: data-api/data-format
I tested this and is working when writing data through the Device Sync SDK. However, when I tried to write to the database using Data API, it is giving me a document validation error.
The log on my client side:
[log] Exception: "Failed to insert document: FunctionError: insert not permitted"
And the log on the server side:
Error:
ERROR: could not validate document 'ObjectID("66a0415758742260f090e325")' for insert
{
"name": "data/v1/insertOne"
}
After some testing, removing mixed value fields from the write operation through Data API, the document was written successfully. I assume this is because Data API doesn’t understand the concept of “mixed” bsonType as it is understood by Device Sync schema. This is the schema written by Device Sync in Development Mode:
"mixedData": {
"bsonType": "mixed"
},
Can someone from please verify if this is supported in Data API or not? If supported, what is the eJson format? (e.g. $mixed?) If not, is there any effort to support this?
Thank you in advance for any help.