Hi,
I want to put a document similar to the following.
{
"key_1": [
{
"key_2": [
{
"key_3": [
{
"key_4": [
{
"key_5": [
{
"key_6": "value"
}
]
}
]
}
]
}
]
}
],
"_rev": "1-37878bf6becb76fbebd441aaa7cbd732",
"_id": "test_document"
}
I successfully put it by using Couchbase Lite 1.4 in my Xamarin Android and Xamarin iOS projects.
However when I try to put a document by using 2.0 development build in my UWP project, I get “LiteCoreException (4): Fleece encode/decode error” exception while saving document to database.
When the count of nested arrays is less than 6 it works fine but if it is equal or more than 6 I get exception.
My code for putting document is below.
...
var props = CreateNestedProperties(1, 6);
document.Set(props);
database.Save(document); // Exception
...
private Dictionary<string, object> CreateNestedProperties(int index, int count)
{
var dict = new Dictionary<string, object>();
if (index < count)
{
dict.Add("key_" + index, new Dictionary<string, object>[1]
{
CreateNestedProperties(index + 1, count)
});
}
else
{
dict.Add("key_" + index, "value");
}
return dict;
}
I wrote this code just for demonstrating the issue, the document will be more complex and arrays will have more than one element.
Thanks.