#How to Filter Entries Where a Field Does Not Contain # in Payload CMS?

7 messages · Page 1 of 1 (latest)

last shell
#

Hi everyone,

I’m trying to filter documents in Payload CMS where a field (e.g., name) does not contain the # character. For example, given the following name values:
Product#1 Product#2 Product3

I want to retrieve only the entries that don’t have # in the name (e.g., Product3).

Any help or suggestions would be greatly appreciated!

Thanks in advance!

quasi ingotBOT
hidden matrix
#

you might want to create a feature request for not_like

simple kelp
#

A match (meaning regex) may be a better feature request.

hidden matrix
#

can do both

#

anyway to work around your problem for now, you can either drop down to the db adapter or create a field that has a beforeChange hook that sets the value to true if it sees a #, then filter by that

simple kelp
#

A high level (like and and or) option for not may be another good addtion to the Where symantics.