Below is the sample "Order" document which is stored in RavenDB. In case if i want to update only a single nested document eg. "Product": "products/2-A" I want to update this nested element alone, how to can I achieve this using Raven C# client ?
Sample JSON document:
{
"Company": "companies/65-A",
"Employee": "employees/1-A",
"Freight": 8.53,
"Lines": [
{
"Discount": 0.2,
"PricePerUnit": 19,
"Product": "products/2-A",
"ProductName": "Chang",
"Quantity": 24
},
{
"Discount": 0,
"PricePerUnit": 10,
"Product": "products/3-A",
"ProductName": "Aniseed Syrup",
"Quantity": 4
},
{
"Discount": 0,
"PricePerUnit": 22,
"Product": "products/4-A",
"ProductName": "Chef Anton's Cajun Seasoning",
"Quantity": 1
}
],
"OrderedAt": "1998-05-06T00:00:00.0000000",
"RequireAt": "1998-06-03T00:00:00.0000000",
"ShipTo": {
"City": "Albuquerque",
"Country": "USA",
"Line1": "2817 Milton Dr.",
"Line2": null,
"Location": {
"Latitude": 35.1154322,
"Longitude": -106.6710792
},
"PostalCode": "87110",
"Region": "NM"
},
"ShipVia": "shippers/2-A",
"ShippedAt": null,
"@metadata": {
"@collection": "Orders",
"@flags": "HasRevisions"
}
}
Please provide your suggestions. Thanks
Sound like you are looking for Patch, take a look at this documentation.
https://ravendb.net/docs/article-page/4.1/csharp/client-api%2foperations%2fpatching%2fset-based