V
V
Vadim2020-10-25 21:58:52
MongoDB
Vadim, 2020-10-25 21:58:52

How to fix duplicate data in mongodb?

Hello everyone,

how to fix duplicate data in mongodb:

com.mongodb.DuplicateKeyException: Write failed with error code 11000 and error message 'E11000 duplicate key error collection: sys_db.index_field_types index: index_name_1 dup key: { index_name: "graylog_0" }'


all the best,
Vadim

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Max, 2020-10-25
@7workers

read about "upsert" maybe it will work: https://docs.mongodb.com/manual/reference/method/d...
either check before inserting
or catch an exception and ignore the
database is not guilty, which force you to insert the same thing twice: )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question