Closed
Description
- 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
'rename_embedded_id_field' => false
orDB::connection('mongodb')->setRenameEmbeddedIdField(false);
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