find Object that has few related objects in list at a time

I have 2 tables: Product and Category.
Product has field ‘categories’ and it can have from 0 to many categories.

I need to find all Product objects that have several Category objects.
I was trying next where:

categories.objectId='E5F2C6DA-3278-CA05-FF5B-6FE8EA341500' AND categories.objectId='9A588714-C2ED-6AB6-FF2C-842994E90000'

but it didn’t work as I expected.

Is it possible to do such request?

Hi Oleg,

what language do you use? Or you make REST request in admin console?

Stanislaw

Hi Stanislav,
I’m using REST request from admin console.

Unfortunately, I think it’s not possible…

Is it a bug or unsupported feature?
Cause where with ‘OR’ (instead of AND) works perfect.

categories.objectId='E5F2C6DA-3278-CA05-FF5B-6FE8EA341500' OR categories.objectId='9A588714-C2ED-6AB6-FF2C-842994E90000'

Can I expect it to be working in near future?
Or maybe you can add such feature request?

I am not aware whether it is a bug or just unsupported feature, but I think it’s a good idea to implement (or fix) this.
We will discuss it and inform you about our decision.

Regards,
Stanislaw

Thanks, Stas!

Best Regards,
Oleg

Hi Oleg,

The query with AND works as expected, but it’s logically wrong: you’re searching the objects, which have both objectIds (‘E5F2C6DA-3278-CA05-FF5B-6FE8EA341500’ AND ‘9A588714-C2ED-6AB6-FF2C-842994E90000’), which is obviously impossible. The query with OR seems more correct, but I think I don’t fully understand what you want to achieve. Do you want to retrieve Products, which have either category with ID ‘E5F2C6DA-3278-CA05-FF5B-6FE8EA341500’ or category with ID ‘9A588714-C2ED-6AB6-FF2C-842994E90000’?

Hi Sergey,
after rethinking this case in a “plain sql way” I’d rather agree with you, that it’s not so logical as it looked before.
The goal was to find such product that simultaneously have several categories(or better to say attributes).
The global idea of that was to implement filtering.
For example:

get all products that are white or black and have large size,
so where would be smth like this: “(categories.name=‘white’ OR categories.name=‘black’) AND categories.name=‘large’”.
But now we decided to divide Category entity into several entities by type.

Thanks for support.

With Best Regards,
Oleg