Skip to content

E11000 duplicate key error collection #5

@NikolayMurha

Description

@NikolayMurha

Hello.

I have "E11000 duplicate key error collection: project_db.users index: id dup key..."
I investigate this and noticed, that problem in embeded models with cascade_callbacks: true option. This case actual only for new models.

Because this callback called inside insert workflow:
https://github.com/shrinerb/shrine-mongoid/blob/master/lib/shrine/plugins/mongoid.rb#L95
and inserted parent record before main insert executed.
Thanks!

Rails 6.0.1
Mongoid 7.0.5

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