question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MongoDB `facebookId_1` duplicate `null` key

See original GitHub issue

Mongod 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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mohamedsamaracommented, Mar 13, 2021

@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.

0reactions
mohamedsamaracommented, Apr 3, 2021

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found