Skip to content

Setting rename_embedded_id_field to false prevents application setting the main id/_id field #3428

@ctadlock

Description

@ctadlock
  • Laravel-mongodb Version: 5.4.1
  • PHP Version: 8.4
  • Laravel: 12.20.0

Description:

Steps to reproduce

  1. Set rename_embedded_id_field to false in config
  2. Set a documents id field to an application value "12345"
  3. insert the model

Expected behaviour

The _id field should be "12345"

Actual behaviour

A generated ObjectID is used

Logs: Insert log.txt here (if necessary)

Im setting this value because I have a nested object with id google.id that I dont want to be _id

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions