Hi, I reciving this error on running migration in Laravel 11.4.* project.
Index build failed: ef9d322e-aea1-4238-8ecf-f53f6fa37ca0: Collection inopy.sessions ( 4565bb8b-ebd5-46b1-b38d-4309b198635e ) :: caused by :: E11000 duplicate key error collection: inopy.sessions index: id_1 dup key: { id: “YLILTwt4MAQyUKpB87hb92Ti8hGYAAIJz7Ne0FcN” }
How to solve this error?
Laravel 11.4.0
MongoDB Community Server last version - Ubuntu 22.04
Google Gemini said me - > Try recreate collection. - Didn’t helped.
Google Search is not have my issue decision. ;(
You are trying to create a unique index on a field which contains duplicated values through the collection.
You need to identify which documents have the duplicate field value and change them, or create an index which is not unique.
I solved it via set SESSION_DRIVER=file
in environment (.env).
Note: If you using ->after() function in migration, remove it, it for only MySQL (this is also available in Jetstream, maybe and Breeze).
system
(system)
Closed
4
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.