I have a list of objects as such:
[
{
"UserId": 100,
....
Statistics: { ... }
},
{
"UserId": 200,
....
Statistics: { ... }
},
{
"UserId": 300,
....
Statistics: { ... }
},
]
It is possible, in one shot, to create an update/filter statement which would replace the “Statistics” embedded document (while keeping all other fields as they are) for each one of the users. Each user has its own data in the “Statistics”. I am using the C# MongoDB driver.
I understand if I want an atomic operation I might have to use a session, but excluding a session, and if I am Ok with the operation not being atomic, just performant, is there anyway to do the above mentioned update without a for loop for each user?
Reading through the documentation I do not see a way to handle this, but the C# driver documentation only go over basic use cases.