Skip to content

Nested ids remapped even if renameEmbeddedIdField is false #3351

Closed
@NickHuijgen

Description

@NickHuijgen
  • 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions