Uploaded image for project: 'PHP ORMs'
  1. PHP ORMs
  2. PHPORM-320

laravel-mongodb - Issue #3351: Nested ids remapped even if renameEmbeddedIdField is false

    • None
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • 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

            Assignee:
            jerome.tamarelle@mongodb.com Jérôme Tamarelle
            Reporter:
            dbeng-pm-bot TPM Jira Automations Bot
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: