Thank you very much, I'm on my way! The only issue I have is that I'm
getting an exception that says: Unable to cast object of type
'Newtonsoft.Json.Linq.JValue' to type 'Newtonsoft.Json.Linq.JObject'.
Also, it is actually an IList<string>, not an array, but the JSON was
still correct above.
My query is as follows: (oldTagName and newTagName are strings, as is
the list trying to be modified)
session.Advanced.DatabaseCommands.UpdateByIndex("MyIndex",
new IndexQuery
{
Query = "Notes:" + oldTagName
},
new PatchRequest[]
{
new PatchRequest
{
Name = "Comment.Notes",
Type = PatchCommandType.Modify,
AllPositions = true,
Nested = new PatchRequest[]
{
new PatchRequest
{
Type = PatchCommandType.Remove,
Value = oldTagName
},
new PatchRequest
{
Type = PatchCommandType.Add,
Value = newTagName
}
}
}
},
false
);
Any ideas that pop into mind?
Thanks,
Mike
On Apr 11, 9:34 am, Ayende Rahien <
aye...@ayende.com> wrote:
> It will look something like:
>
> store.DatabaseCommands.UpdateByIndex("YourIndex", new IndexQuery
> {
> Query = "Note:old"}, new PatchRequest[]
>
> {
> new PatchRequest
> {
> Name = "Comment",
> Type = PatchCommandType.Modify,
> Nested = new PatchRequest[]
> {
> new PatchRequest
> {
> Type = PatchCommandType.Remove,
> Value = "old"},
>
> new PatchRequest
> {
> Type = PatchCommandType.Add,
> Value = "new"
> },
>
>
>
> }
> },
> }, true);
> On Mon, Apr 11, 2011 at 4:27 PM, Mike Sopinka <
msopi...@gmail.com> wrote:
> > Hello,
>
> > I have a roadblock i've hit that I can't seem to find an answer too.
> > I have an array of strings, and I want to replace one of the values in
> > that array for all documents.
>
> > I found "set-based updates" in the HTML API, which looks close to what
> > I want to do. Basically I have my document:
>
> > {
> > "Id": 1,
> > "Comment":
> > {
> > "Notes": [ "old", "wpf", "c#" ]
> > }
> > }
>
> > And I want to do something like:
> > UPDATE documents
> > SET value = "new"
> > WHERE Notes CONTAINS "old"
>
> > So the resulting document would be:
>
> > {
> > "Id": 1,
> > "Comment":
> > {
> > "Notes": [ "new", "wpf", "c#" ]
> > }
> > }
>
> > And I'd want this done for all documents. Is this possible with the
> > CLIENT API?
>
> > Let me know if I need to clarify anything confusing.
>
> > Thanks!
>
> > Mike- Hide quoted text -
>
> - Show quoted text -