laraveljenssegers-mongodb

Why I got duplicate key error collection: sessions index error with jenssegers/mongodb?


I started new laravel 9 (with jet and inertia, without team) app with "jenssegers/mongodb": "^3.9" installed. I changed connection to mongo MngProducts database and run migrations.

But running homepage with controller defined I got error on second request :

E11000 duplicate key error collection: MngProducts.sessions index: id_1 dup key: { id: "loBh99XTp9cm3Qj17YqKhVFTuxM8bvpd14wczWQa" }

In Compass I see 1 row in sessions : https://prnt.sc/irFNeSAU-zN4

I migrated all default 4 laravel tables(without any data in them) and why I have this error and how that can be fixed?

Thanks!


Solution

  • Setting in .env file :

    SESSION_DRIVER=file
    

    fixed this issue.