OR Operator or similar

Hi,

We are a B2B company, and we use Contentful to store Events. I have an scenario where some of these events are private for a specific Company (or many companies), and some others are public events, available to all companies. As an employee, when I log in to the platform, I want to get all my company events + all public events (Events with empty “companies” relation).

For this purpose, I would like to do some kind of “OR” between these two conditions:

  • query['fields.companies.sys.id[in]'] = args.companyId // My company events
  • query['fields.companies.[exists]'] = false // Public events

I’ve tried things like query['fields.companies.sys.id[in]'] = [args.company, null], but I haven’t found the way to match events with empty companies.

Important to note is that, if I do two different requests, I’ll loose the ability to use limit and offset for pagination, so I have discarded this option.

I would really appreciate any good ideas to solve this case, either by better querying or changing my event - companies model.

Best regards

1 Like

Unfortunately, the Content Delivery API does not support OR filtering; however, the GraphQL API does, so this would be a good use case to leverage that API instead. Hope this helps!