-
Type:
Question
-
Resolution: Fixed
-
Priority:
Unknown
-
Affects Version/s: None
-
Component/s: Laravel
-
None
-
Not Needed
-
-
None
-
None
-
None
-
None
-
None
-
None
NickHuijgen has created Issue #3351: Nested ids remapped even if renameEmbeddedIdField is false in laravel-mongodb. This Jira ticket was filed by GromNaN
Issue Text:
- Laravel-mongodb Version: 5.3
- PHP Version: 8.3
- Database Driver & Version: -
Description:
I'm trying to query based on the `id` field of a nested array document. When attempting to query the `id` field is remapped to `_id` regardless of the `renameEmbeddedIdField` setting.
If I modify my query to include another `where()` clause, the `id` field is not remapped to `_id`
`Model::query()>where('id', 1)>where('nested.id', 1)->get()` -> does not remap `nested.id`
`Model::query()>where('nested.id', 1)>get()` -> remaps `nested.id`
Steps to reproduce
1. `'rename_embedded_id_field' => false` or `DB::connection('mongodb')->setRenameEmbeddedIdField(false);`
2. `Model::query()>where('nested.id', 1)>get();`
Expected behaviour
`nested.id` should not be remapped to `nested._id` in the query because `renameEmbeddedIdField` is set to `false`
Actual behaviour
In the query that is executed `nested.id` is remapped to `nested._id` in the query