Closed
Description
Description:
Querying using whereIn("subarray._id", [...]) does not work, when subarray has an array of items with '_id' field. If you had subarray of items with 'id' instead of '_id' and then queried for "subarray.id" it would work.
However querying using whereRaw(['subarray._id' => ['$in' => ['id_value'']]]) works as expected. I tried transforming the array of _id strings into an array of ObjectIds but it didn't help.
Steps to reproduce
- Create a document with a subarray of items where each item will have an _id field
- Try a query using whereIn("subarray._id", [...]) = will not return results
- Now do the same but create a document with a subarray of items where each item will have an id field
- Try a query using whereIn("subarray.id", [...]) = will return results
Expected behaviour
It should work as normal, as in step 4
Actual behaviour
It returned no results while there definitely were matches