Enable filtering on array columns

What is the feature?

Right now, we can’t filter on array columns, it would be very nice to be able to use a filter “column contains value”

What problem does this solve for you?

I have an array column, and I would like to filter my collection using a contains filter.
I have a custom backend and it’s ready on my side, but I can’t enable that feature on Forest Admin, so it’s a bit frustrating :smile:

Who else would be using this feature?

Operations

3 Likes

Thanks for the feedback, Julien!

We’ve sent this to our product features tracking system. We don’t have any plan to improve our filters in the short term, but we’ll be sure to take your input under consideration once we do.

Best,
Marc

@anon15707845 I was quite surprised this was not supported.
Could you elaborate what is the technical reason here? I see the schema for array fields does give a "isFilterable": true,.

So it must be a layout/rendering side consideration on the client.
Would love to know if we can somehow help here to make this happen. On Mongo at least - even if you treated the column as a single value (assuming non-complex array type) it would just work since mongo’s syntax can handle it.

i.e. { "field": "val" } filter works for both String and [String] fields out of the box. This alone would give relief to many users I assume (including us).

Another thing, in fact - if you add the “array” field to the searchable fields list - The system would perform this kind of expression on the field:
{ arrField: /.*term.*/i } which on the good side is a workaround in a way, but on the downside is so inefficient and would most likely results in a collection scan not using any indexes on this array field.
:man_facepalming:

Hi @Yoad_Snapir,

I’ve added your insight to our feature request tracking tool. There is a priori no technical reason why it couldn’t be possible to implement. We simply haven’t got around to it yet.

Best,
Marc

1 Like

Awesome,
As an input to any engineering looking into this - I did confirm the Liana server side has no problem using a normal “equal” operator on Array string fields as if it was a single String. (I manipulated the client API request to Liana on the fly). Works perfectly fine - even using $in: [] to compare to multiple values works without a problem.

2 Likes