TypeError: documents.map is not a function DBCollection.prototype.insertMany@src/mongo/shell/crud_api.js:295:1

Error: E QUERY    [thread1] TypeError: documents.map is not a function :




If you are facing this error while insert multiple records in mongodb, Please check syntax carefully.
Don't enter in trap of mongo db version. insertMany is supported from version 3.2

Your command was : without square bracket, I have added below and now this will work

db.emp.insertMany ([{"id":4 ,"name":"Mradul sahai", "dept":2},{"id":3, "name":"Rakesh Sharma", "dept":2}])


2 comments:

Algae Services. Powered by Blogger.