MongoDB Error in inserting documents, how do I resolve it?

Multi tool use
up vote
0
down vote
favorite
I have been trying to import a JSON file into mongoDB via command prompt, but I get an output that says error inserting documents.
C:UserscheryDocumentsNUS Y2 Sem 1 ModulesBT2102Tutorials>mongoimport --db school --collection students students.json
2018-11-07T15:37:30.974+0800 connected to: localhost
2018-11-07T15:37:31.210+0800 num failures: 50
2018-11-07T15:37:31.211+0800 error inserting documents: multiple errors in bulk operation:
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 2 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 3 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 4 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 5 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 1 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 0 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 6 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 7 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 10 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 8 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 12 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 13 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 11 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 14 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 15 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 16 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 17 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 18 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 9 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 19 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 20 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 23 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 24 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 22 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 26 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 25 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 27 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 29 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 28 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 21 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 30 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 31 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 33 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 35 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 34 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 36 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 37 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 38 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 32 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 40 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 39 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 41 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 43 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 44 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 46 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 47 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 42 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 45 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 48 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 49 }
2018-11-07T15:37:31.211+0800 imported 0 documents
May I know what is the issue here and how do I rectify the error?
I would really appreciate any help out there!
mongodb
add a comment |
up vote
0
down vote
favorite
I have been trying to import a JSON file into mongoDB via command prompt, but I get an output that says error inserting documents.
C:UserscheryDocumentsNUS Y2 Sem 1 ModulesBT2102Tutorials>mongoimport --db school --collection students students.json
2018-11-07T15:37:30.974+0800 connected to: localhost
2018-11-07T15:37:31.210+0800 num failures: 50
2018-11-07T15:37:31.211+0800 error inserting documents: multiple errors in bulk operation:
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 2 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 3 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 4 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 5 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 1 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 0 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 6 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 7 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 10 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 8 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 12 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 13 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 11 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 14 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 15 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 16 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 17 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 18 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 9 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 19 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 20 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 23 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 24 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 22 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 26 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 25 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 27 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 29 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 28 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 21 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 30 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 31 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 33 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 35 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 34 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 36 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 37 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 38 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 32 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 40 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 39 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 41 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 43 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 44 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 46 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 47 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 42 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 45 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 48 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 49 }
2018-11-07T15:37:31.211+0800 imported 0 documents
May I know what is the issue here and how do I rectify the error?
I would really appreciate any help out there!
mongodb
You are trying to insert documents with an_id
that already exists. Depending on your application you may want to update that existing document instead, or maybe set a different_id
. It is also possible that you are setting_id
to something you did not really intend to -- it looks weird in the error message. Double-check how the document looks.
– Thilo
Nov 7 at 7:46
As a general rule of thumb, and adding on top of what @Thilo already mentions in the comment above, you should avoid using custom values in the "_id" field and let MongoDB generate ObjectIds for you. In other words, do not set _id to anything in your documents if at all possible, that will improve performance and guarantee uniqueness (for that particular key).
– Gorka Hernandez
Nov 7 at 8:38
1
You can try and import into a different collection and work with that collection if this is just a tutorial or drop the existing collection first and then import again if the existing data is not needed
– Ryan Dobbs
Nov 7 at 13:53
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have been trying to import a JSON file into mongoDB via command prompt, but I get an output that says error inserting documents.
C:UserscheryDocumentsNUS Y2 Sem 1 ModulesBT2102Tutorials>mongoimport --db school --collection students students.json
2018-11-07T15:37:30.974+0800 connected to: localhost
2018-11-07T15:37:31.210+0800 num failures: 50
2018-11-07T15:37:31.211+0800 error inserting documents: multiple errors in bulk operation:
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 2 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 3 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 4 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 5 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 1 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 0 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 6 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 7 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 10 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 8 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 12 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 13 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 11 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 14 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 15 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 16 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 17 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 18 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 9 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 19 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 20 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 23 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 24 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 22 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 26 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 25 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 27 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 29 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 28 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 21 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 30 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 31 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 33 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 35 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 34 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 36 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 37 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 38 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 32 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 40 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 39 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 41 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 43 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 44 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 46 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 47 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 42 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 45 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 48 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 49 }
2018-11-07T15:37:31.211+0800 imported 0 documents
May I know what is the issue here and how do I rectify the error?
I would really appreciate any help out there!
mongodb
I have been trying to import a JSON file into mongoDB via command prompt, but I get an output that says error inserting documents.
C:UserscheryDocumentsNUS Y2 Sem 1 ModulesBT2102Tutorials>mongoimport --db school --collection students students.json
2018-11-07T15:37:30.974+0800 connected to: localhost
2018-11-07T15:37:31.210+0800 num failures: 50
2018-11-07T15:37:31.211+0800 error inserting documents: multiple errors in bulk operation:
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 2 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 3 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 4 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 5 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 1 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 0 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 6 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 7 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 10 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 8 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 12 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 13 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 11 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 14 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 15 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 16 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 17 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 18 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 9 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 19 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 20 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 23 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 24 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 22 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 26 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 25 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 27 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 29 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 28 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 21 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 30 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 31 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 33 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 35 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 34 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 36 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 37 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 38 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 32 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 40 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 39 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 41 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 43 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 44 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 46 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 47 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 42 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 45 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 48 }
- E11000 duplicate key error collection: school.students index: _id_ dup key: { : 49 }
2018-11-07T15:37:31.211+0800 imported 0 documents
May I know what is the issue here and how do I rectify the error?
I would really appreciate any help out there!
mongodb
mongodb
asked Nov 7 at 7:44
Cheryl
65
65
You are trying to insert documents with an_id
that already exists. Depending on your application you may want to update that existing document instead, or maybe set a different_id
. It is also possible that you are setting_id
to something you did not really intend to -- it looks weird in the error message. Double-check how the document looks.
– Thilo
Nov 7 at 7:46
As a general rule of thumb, and adding on top of what @Thilo already mentions in the comment above, you should avoid using custom values in the "_id" field and let MongoDB generate ObjectIds for you. In other words, do not set _id to anything in your documents if at all possible, that will improve performance and guarantee uniqueness (for that particular key).
– Gorka Hernandez
Nov 7 at 8:38
1
You can try and import into a different collection and work with that collection if this is just a tutorial or drop the existing collection first and then import again if the existing data is not needed
– Ryan Dobbs
Nov 7 at 13:53
add a comment |
You are trying to insert documents with an_id
that already exists. Depending on your application you may want to update that existing document instead, or maybe set a different_id
. It is also possible that you are setting_id
to something you did not really intend to -- it looks weird in the error message. Double-check how the document looks.
– Thilo
Nov 7 at 7:46
As a general rule of thumb, and adding on top of what @Thilo already mentions in the comment above, you should avoid using custom values in the "_id" field and let MongoDB generate ObjectIds for you. In other words, do not set _id to anything in your documents if at all possible, that will improve performance and guarantee uniqueness (for that particular key).
– Gorka Hernandez
Nov 7 at 8:38
1
You can try and import into a different collection and work with that collection if this is just a tutorial or drop the existing collection first and then import again if the existing data is not needed
– Ryan Dobbs
Nov 7 at 13:53
You are trying to insert documents with an
_id
that already exists. Depending on your application you may want to update that existing document instead, or maybe set a different _id
. It is also possible that you are setting _id
to something you did not really intend to -- it looks weird in the error message. Double-check how the document looks.– Thilo
Nov 7 at 7:46
You are trying to insert documents with an
_id
that already exists. Depending on your application you may want to update that existing document instead, or maybe set a different _id
. It is also possible that you are setting _id
to something you did not really intend to -- it looks weird in the error message. Double-check how the document looks.– Thilo
Nov 7 at 7:46
As a general rule of thumb, and adding on top of what @Thilo already mentions in the comment above, you should avoid using custom values in the "_id" field and let MongoDB generate ObjectIds for you. In other words, do not set _id to anything in your documents if at all possible, that will improve performance and guarantee uniqueness (for that particular key).
– Gorka Hernandez
Nov 7 at 8:38
As a general rule of thumb, and adding on top of what @Thilo already mentions in the comment above, you should avoid using custom values in the "_id" field and let MongoDB generate ObjectIds for you. In other words, do not set _id to anything in your documents if at all possible, that will improve performance and guarantee uniqueness (for that particular key).
– Gorka Hernandez
Nov 7 at 8:38
1
1
You can try and import into a different collection and work with that collection if this is just a tutorial or drop the existing collection first and then import again if the existing data is not needed
– Ryan Dobbs
Nov 7 at 13:53
You can try and import into a different collection and work with that collection if this is just a tutorial or drop the existing collection first and then import again if the existing data is not needed
– Ryan Dobbs
Nov 7 at 13:53
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53185285%2fmongodb-error-in-inserting-documents-how-do-i-resolve-it%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
KnqKGxn3tIU zAySjqp6zU1K 8Cf5fks Fi iMETJENw1IG9iffp,VUvu
You are trying to insert documents with an
_id
that already exists. Depending on your application you may want to update that existing document instead, or maybe set a different_id
. It is also possible that you are setting_id
to something you did not really intend to -- it looks weird in the error message. Double-check how the document looks.– Thilo
Nov 7 at 7:46
As a general rule of thumb, and adding on top of what @Thilo already mentions in the comment above, you should avoid using custom values in the "_id" field and let MongoDB generate ObjectIds for you. In other words, do not set _id to anything in your documents if at all possible, that will improve performance and guarantee uniqueness (for that particular key).
– Gorka Hernandez
Nov 7 at 8:38
1
You can try and import into a different collection and work with that collection if this is just a tutorial or drop the existing collection first and then import again if the existing data is not needed
– Ryan Dobbs
Nov 7 at 13:53