MongoDB `facebookId_1` duplicate `null` key
See original GitHub issueMongod version: 4.4.2
MongoError: E11000 duplicate key error collection: mern-ecommerce-test.users index: facebookId_1 dup key: { facebookId: null }
at Function.create (/home/sneknotsnake/reactjs/mern-ecommerce/node_modules/mongodb/lib/core/error.js:57:12)
at toError (/home/sneknotsnake/reactjs/mern-ecommerce/node_modules/mongodb/lib/utils.js:123:22)
at /home/sneknotsnake/reactjs/mern-ecommerce/node_modules/mongodb/lib/operations/common_functions.js:265:39
at handler (/home/sneknotsnake/reactjs/mern-ecommerce/node_modules/mongodb/lib/core/sdam/topology.js:942:24)
at /home/sneknotsnake/reactjs/mern-ecommerce/node_modules/mongodb/lib/cmap/connection_pool.js:350:13
at handleOperationResult (/home/sneknotsnake/reactjs/mern-ecommerce/node_modules/mongodb/lib/core/sdam/server.js:558:5)
at MessageStream.messageHandler (/home/sneknotsnake/reactjs/mern-ecommerce/node_modules/mongodb/lib/cmap/connection.js:277:5)
at MessageStream.emit (events.js:315:20)
at MessageStream.EventEmitter.emit (domain.js:467:12)
at processIncomingData (/home/sneknotsnake/reactjs/mern-ecommerce/node_modules/mongodb/lib/cmap/message_stream.js:144:12)
at MessageStream._write (/home/sneknotsnake/reactjs/mern-ecommerce/node_modules/mongodb/lib/cmap/message_stream.js:42:5)
at writeOrBuffer (internal/streams/writable.js:358:12)
at MessageStream.Writable.write (internal/streams/writable.js:303:10)
at Socket.ondata (internal/streams/readable.js:719:22)
at Socket.emit (events.js:315:20)
at Socket.EventEmitter.emit (domain.js:467:12)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
driver: true,
index: 0,
code: 11000,
keyPattern: { facebookId: 1 },
keyValue: { facebookId: null }
}
Steps to reproduce (at least in my machine):
- Create two accounts that don’t use facebook
I was able to solve this problem using this stackoverflow answer, but IDK why is this only happening to me.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Duplicate key key error collection - I know what it is but I don't ...
I'm getting the Duplicate key error collection message. As far as I know this issue is because there is a duplicate key in...
Read more >MongoDB show duplicate key is null? - DBA Stack Exchange
This means that only a single document in the collection can be missing the unique field. The duplicate key message includes the index...
Read more >Mongodb duplicate key error collection dup key: null
The plugin works for both scalar and document arrays.For your case you can do the following changes. var uniqueArrayPlugin = require('mongoose- ...
Read more >[SERVER-35988] MongoDB show duplicate key is null?
I got the dup key message when I executed this. mongos> db.setup.findAndModify({ ... query : { ...
Read more >How to solve MongoDB E11000 duplicate key error when ...
How to solve MongoDB E11000 duplicate key error when embedded document is null. November 15, 2019. This post is going to be a...
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
@TrustFirst12 Mailchimp keys are missing, these keys are secrets and are not shared between projects. You need to obtain them from your Mailchimp account and put them in an .env file in the project. Here is an example of the env file.
@Walf-dev This is a generic error that is passed to the frontend app. If you want to see the error you can log it on this line. Adding an image will use AWS S3 Bucket so please make sure you add the keys that are associated with your S3 Bucket on AWS account.