If collection config have fields with type:
And they have a name, flattenFields will skip sub-fields
Caused by this check, it'd be better to first check if field have a sub-fields despite having a name, then if it doesn't check for a name and return new array
Hey @HoneySpace — this is actually working as intended, although the function could be misleading. It does not flatten ALL fields, it only flattens the fields that exist within a non-named field.
What are you looking to do? Can I help? Gonna convert this to a discussion to keep it going.
Well, I was actualy trying to extend search cappabilities, since Payload API supporst search in nested fields, all I needed was to change how fields get seleceted for building query
I changed flatten fucntion so it flatten all fields and added extra function to crawl through first-level fields to add collection fields to relationship fields
Now I have very flexable search controled just by listSearchableFields
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.