sample_test> db.students.insertMany({"name":"abc","age":30,"location":"mumbai"},{"name":"def","age":26,"location":"thane"},{"name":"ghi","age":27,"location":"nasik"})
MongoInvalidArgumentError: Argument "docs" must be an array of documents
Answer:
Using square brackets "[]" while passing documents in array form as parameter in "insertMany" issue has been resolved.
sample_test> db.students.insertMany([{"name":"abc","age":30,"location":"mumbai"},{"name":"def","age":26,"location":"thane"},{"name":"ghi","age":27,"location":"nasik"}])
{
acknowledged: true,
insertedIds: {
'0': ObjectId("......"),
'1': ObjectId("......"),
'2': ObjectId("......")
}
}