#community-help

Making a Field as Object[] or Empty

TLDR Jameshwart faced an issue with object and object[] fields. Kishore Nallan suggested using "optional": true, which resolved the issue.

Powered by Struct AI
+11
9
4mo
Solved
Join the chat
May 08, 2023 (4 months ago)
Jameshwart
Photo of md5-283d3397742c32cc2b6be6bda508c03e
Jameshwart
03:39 AM
is there a way to make a field either object[] or empty?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
03:45 AM
Set type as object or object[]
Jameshwart
Photo of md5-283d3397742c32cc2b6be6bda508c03e
Jameshwart
03:46 AM
like this Kishore Nallan?
Image 1 for like this <span class="s-mention s-user"> <strong>Kishore Nallan</strong></span>?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
03:47 AM
No, just object if it's an object. object[] if it's an array of object
Jameshwart
Photo of md5-283d3397742c32cc2b6be6bda508c03e
Jameshwart
03:49 AM
the problem is when i set the data type to be object[] and the document doesn't have a data then it is throwing an error that the field is not found.
See
Image 1 for the problem is when i set the data type to be object[] and the document doesn't have a data then it is throwing an error that the field is not found.<br>See
03:50
Jameshwart
03:50 AM
same thing to object. in my case is the thumbnail. when I don't send the fields it is looking for the field.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
03:51 AM
Have you tried setting "optional": true
Jameshwart
Photo of md5-283d3397742c32cc2b6be6bda508c03e
Jameshwart
03:52 AM
testing
03:53
Jameshwart
03:53 AM
thanks that helped.
+11