With the same code I get:
> db.playerTest.find()
{ "_id" : 0 }
{ "_id" : 1 }
> db.playerTest.updateMany({},{$set: {"clubs": [[ { "clubId": ObjectId("6076030465508936f00e086c")}, {"name": "Augusta National Golf Club"}, {"nickName": "Augusta"}, {"logoPath": "augusta.png"}]]}})
{ "acknowledged" : true, "matchedCount" : 2, "modifiedCount" : 2 }
> db.playerTest.find()
{ "_id" : 0, "clubs" : [ [ { "clubId" : ObjectId("6076030465508936f00e086c") }, { "name" : "Augusta National Golf Club" }, { "nickName" : "Augusta" }, { "logoPath" : "augusta.png" } ] ] }
{ "_id" : 1, "clubs" : [ [ { "clubId" : ObjectId("6076030465508936f00e086c") }, { "name" : "Augusta National Golf Club" }, { "nickName" : "Augusta" }, { "logoPath" : "augusta.png" } ] ] }
I can see one of 2 things
- is that your collection that contains the 2 documents is NOT named playerTest
- you are not using the database that contains the playerTest collection
Share the output of:
- db.playerTest.find()
- db