Answer the question
In order to leave comments, you need to log in
mongoDB error email_1 dup key: { email: null } but I don't use email?
Good afternoon, made additions of products. 1 product is added perfectly, but the second one gives such an error.
message: "E11000 duplicate key error collection: dbName .products index: email_1 dup key: { email: null }"
I looked it up on Google and it says that the e-mail must be unique or not null as in this case.
But the problem is that these are products, they do not receive a bunch of e-mails.
Here is a diagram
const {Schema, model, Types} = require('mongoose')
const schema = new Schema({
name: {type: String, required: true},
price: {type: Number, required: true},
rating: {type: Number, default: 4.7},
weight: {type: String, required: true},
})
module.exports = model("Product", schema)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question