frompymongoimportMongoClientclient=MongoClient("mongodb://localhost:27017/")mydb=client['database']mycollection=mydb['myTable']# Insert sample documentsdocuments=[{"_id":1,"dept":"A","item":{"code":"012","color":"red"},"sizes":["S","L"]},{"_id":2,"dept":"A","item":{"code":"012","color":"blue"},"sizes":["M","S"]},{"_id":3,"dept":"B","item":{"code":"101","color":"blue"},"sizes":"L"},{"_id":4,"dept":"A","item":{"code":"679","color":"black"},"sizes":["M"]}]mycollection.insert_many(documents)# Print inserted documentsprint("Inserted Documents:\n")fordocinmycollection.find():print(doc)