Home Mongodb .net updating one of the embedded documents

Mongodb .net updating one of the embedded documents

user4644
1#
user4644 Published in September 19, 2018, 7:04 pm

I have an orders and each has transactions embedded.

{
_id: orderId1,
other_fields: something else,
transactions: [
{
_id: someId,
price: 25,
status: 1
},
{
_id: someId2,
price: 30,
status: 0
}
]
}


Now i want to change the status of one of the transactions(lets say: someId2). How can i do that?

Both orders and transactions are models with transaction as ICollection<Transaction>

Also, is it possible without using any magic string?