Home Mongodb .net updating one of the embedded documents
Reply: 0

Mongodb .net updating one of the embedded documents

user657
1#
user657 Published in June 22, 2018, 11:13 am

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?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.301314 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO