Open
Description
- Laravel-mongodb Version: 3.6.6
- PHP Version: 7.3.18
- Database Driver & Version: mongodb/mongodb 1.6.1
Description:
When using a whereHas filter, if the field under the whereHas clause is a string with a numeric value, getConstrainedRelatedIds
on the QueriesRelationships
trait is returning the keys as numeric instead of string. With that, if the column in the where clause is a string, it fails.
Steps to reproduce
- Create a parent register with a
_id
PK as string and another field for testing purposes, e.g:active: true
. - Create two child associated with the parent register
- Created Example:
Parent: {
_id: "12345",
"active": true
},
Child: {
_id:"id1",
"parent_id": "12345"
},
Child: {
_id: "id2,
"parent_id": "12345"
}
- Run the query:
Child::whereHas('parent', function ($query) {
return $query->where('active', true);
})
Expected behaviour
It should return the two childs
Actual behaviour
None child is returned.
Logs:
Insert log.txt here (if necessary)Metadata
Metadata
Assignees
Labels
No labels