MongoError: E11000 duplicate key error index: sessions.sessions.$sid_1 dup key: { : null }
See original GitHub issueI get the above mentioned error as soon as more than 1 user tries to login into my system.
I am using MongoStore like this
app.use(express.session({
key: 'sid',
secret: 'secret',
store: new MongoStore({
db: 'sessions',
secret: 'mongo store secret!'
})
});
Issue Analytics
- State:
- Created 10 years ago
- Comments:8
Top Results From Across the Web
E11000 duplicate key error index in mongodb mongoose
The error message is saying that there's already a record with null as the email. In other words, you already have a user...
Read more >E11000 duplicate key error collection - MongoDB
I have an index in collection “persons” which shall avoid inserting duplicate documents with the same person name.
Read more >MongoError: E11000 duplicate key error collection
However, I encountered an error. MongoError: E11000 duplicate key error collection: companies index: code_1 dup key: { code: null }.
Read more >MongoDB show duplicate key is null?
The duplicate key message includes the index name and key violation: "errmsg" : "E11000 duplicate key error collection: testdb.setup index: name ...
Read more >Debug E11000 Errors in Mongoose - Mastering JS
MongoError : E11000 duplicate key error collection: test.customers index: _id_ dup key: { : ObjectId('5cc5ea092dca872442916cf5') }.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dhruvasagar 😃
I just confirmed that collection created by connect-mongo has only two indexes by default:
_id_
andexpires_1
. So thesid_1
index mentioned by the error must be created by other session packages.same here,
db.sessions.drop()
fixed it.