Answer the question
In order to leave comments, you need to log in
How to resolve error E11000 in mongoose js?
Hello!
I encountered a non-standard error...
What's the point, when I save the user object I get an error E1100 with this comment
E11000 duplicate key error collection: f5alert.users index: apikey_1 dup key: { apikey: null }
...
code: 11000,
keyPattern: { apikey: 1 },
keyValue: { apikey: null }
const id = ctx.message?.from.id
const newUser = new User({
tel_id: id,
appState: {
action: ACTIONS.WAITING,
payload: {}
}
})
ctx.reply(`Привіт, я покликаний сповіщати про надходженяя нових ремонтів!
Щоб розпочати процес налаштування напиши /setup`)
await newUser.save()
// console.log('user data', {
// tel_id: id,
// appState: {
// action: ACTIONS.WAITING,
// payload: {}
// }
// });
user data { tel_id: *сдесь ID телеграм которое 100% уникальное*, appState: { action: 'WAITING', payload: {} } }
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