store.DatabaseCommands.Patch("BlogPosts/1", new[] {
new PatchRequest() {
Type = PatchCommandType.Remove,
AllPositions = true,
Name = "Comments"
}
});
Hibernating Rhinos Ltd
Oren Eini l CEO l Mobile: + 972-52-548-6969
Office: +972-4-622-7811 l Fax: +972-153-4-622-7811
--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
store.DatabaseCommands.Batch(
new[] {
new PatchCommandData {
Key = "BlogPosts/1",
Patches = new[] {
new PatchRequest {
Type = PatchCommandType.Remove,
Name = "Comments",
Position = 2
},
new PatchRequest {
Type = PatchCommandType.Remove,
Name = "Comments",
Position = 3
}
}
}
});
Hibernating Rhinos Ltd
Oren Eini l CEO l Mobile: + 972-52-548-6969
Office: +972-4-622-7811 l Fax: +972-153-4-622-7811
Oh ok, well that's a very simple yet effective solution though. Thanks.I have another scenario regarding patching and removing. In this case I want to remove two different comments. The only way I know is by using the Position attribute. See my code below:
store.DatabaseCommands.Batch(
new[] {
new PatchCommandData {
Key = "BlogPosts/1",
Patches = new[] {
new PatchRequest {
Type = PatchCommandType.Remove,
Name = "Comments",
Position = 2
},
new PatchRequest {
Type = PatchCommandType.Remove,
Name = "Comments",
Position = 3
}
}
}
});
On Sunday, July 24, 2016 at 12:07:50 PM UTC+2, Oren Eini wrote: