to make sure I’m using the right DB… I’m using use video command
Then I check for the collections into the video DB and everything work fine, I didn’t undestand the shortcuts to get the doc from the movie collection to copy on the noviesScratch so I typed it all and worked just fine had no problems with the insertOne … I even checked with compass…however with
insertMany… is not working… I try window cms, Cmder and microsoft Visual Studio Code (https://www.youtube.com/watch?v=yaRSZwUJIrY) … all of them with same results… I can connect to my cluster but can not use the insertOne command
For your information I’m using MongoDB Enterprise Server V4.2.0
If you look at the error message it says, duplicate key error collection for the very first document that you tried to insert. Can you please make sure the documents hasn’t been inserted already in the collection ?
In MongoDB, you cannot insert two documents in the same collection having the same _id field. When you will execute the query given in the handouts, you are expected to get an error because we have duplicate documents in the list of documents that we are trying to insert using the insertMany() function.
It is very unusual thing to happen. However, I would recommend you to use the cmd for running the mongo shell.
To verify that insertMany() function is working, please execute the below mentioned command from mongo shell.