Hey,
is there a character limit or a limit of elements for the array?
If I concat too much elements with the array, I get an error.
[“WDE0053: Internal wixData error: Unknown error.”]
Hey,
is there a character limit or a limit of elements for the array?
If I concat too much elements with the array, I get an error.
[“WDE0053: Internal wixData error: Unknown error.”]
Hi
According to this article the limit is 0.5 MB.
https://support.wix.com/en/article/field-type-support-and-limitations-in-the-content-manager
This is quite a big capacity
Let’s create an array with 1000 values. And insert it in a collection
let array = [];
for (let i = 1; i <= 1000; i++) {array.push(i)}
console.log(array)
let toInsert = {
'title': 'new2',
'url': 'https://new2',
'someArrays': array,
};
wixData.insert('urls', toInsert)
.then( res => console.log(res))
.catch( err => console.error(err));
Output
It works. A new item with a field with 1000 array values added.
Check your code. Seems like you do something wrong
Or your array is more than 0.5 MB.
Hey,
thanks for your reply
I think my array is too big, the code had no problems in the past and my array hast about 1600 values, I think I have to create a second array for the other values.
Is there a way to get the size of my array? I need to code something like
if (filze size === 0.5 MB) -> insert array in dataset and create a new array with the other values, that haven't been added to an array yet.
Or I set a length limit for the array, but then I can’t use the full storage size.
I really don’t know the way to count the fact memory usage of your array.
1 character is 1 byte approximately.
10 characters cost 10 bytes so … try to count all the characters in your array )))))))
But it can be very difficult and have no sense because you can have an array of 3 objects, each object can have 200 properties, each property 100 more properties and continue… So in theory an array of 3 these objects may cost more than 30 MB of memory.
Very weird situation.
Try to store 600 values for 3 times. Create 3 fields like ‘array1’, ‘array2’, ‘array3’ and always store no more than 600 values.
Or 10 arrays of 200 values
Or 20 arrays of 100 values
Try to do a loop or a recursive function, that can create for you any number of arrays quickly and push values to it from the main array.
Hey, sry for the late reply, I was working on some other projects…
So my idea is to count the array length ( array.toString().length ).
If the max size of the field is 0,5 MB the length can the 500.000 characters (let’s say 490.000 to have some space).
Then I just need a code, to count the length of the array I want to concat, before I add it.
But my array is just about 200.000 characters long, so I think the error was caused by something different. Now the code is working again…
I think my array will be larger that 500.000 characters in the next months, so I will share the code here, as soon as I creat one.