Node.js UnhandledPromiseRejectionWarning error reporting reason solution

UnhandledPromiseRejectionWarning: MongoError: E11000 duplicate key error collection: blog.users index: email_1 dup key: { email: “[email protected]” } An error is reported
insert image description here
because the mailbox I set cannot be duplicated with the mailbox number in the database, so I put it in the database When inserting data with the same mailbox number, the above error will occur!

insert image description here
Solution: Insert after changing the mailbox number, or delete the data in the database, or remove unique.

Guess you like

Origin blog.csdn.net/qq_41329287/article/details/114984567