1

I have a unique _id for every document. So when a document with the same _id which is already imported, I get a duplicate error.

How can I skip already inserted _id's?

if already inserted:
ignore and go to next.
Drise
  • 4,310
  • 5
  • 41
  • 66
aquatic7
  • 615
  • 1
  • 6
  • 19
  • What have you tried? What is the structure of your document ? – Anthony Mar 16 '18 at 21:53
  • I wrote it in the initial post, but a moderator removed the information. I have used a week now searching the web and trying different approaches like upsert. But I don't want to update documents. I only want to insert documents that does not already exists. --------------------------------- Also I don't see how this is a duplicate question when it does not exist. At least redirect to the duplicate thread @styvane if you mean this is a duplicate of an existing question.... – aquatic7 Mar 18 '18 at 20:16
  • Hi @aquatic7, please check this [answer](https://stackoverflow.com/a/36087171/3100115) and let me know if it doesn't give you the expected behavior, in which case should consider to edit your question and tell us why it didn't work and I will be happy to reopen your question and possibly provide you with an answer. – styvane Mar 20 '18 at 19:08

0 Answers0