Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Patch Request - Remove from array

Received: by 10.224.215.194 with SMTP id hf2mr6041334qab.0.1340393963557;
        Fri, 22 Jun 2012 12:39:23 -0700 (PDT)
X-BeenThere: ravendb@googlegroups.com
Received: by 10.229.102.157 with SMTP id g29ls2197623qco.0.gmail; Fri, 22 Jun
 2012 12:39:20 -0700 (PDT)
Received: by 10.224.107.199 with SMTP id c7mr6058800qap.5.1340393960028;
        Fri, 22 Jun 2012 12:39:20 -0700 (PDT)
Received: by 10.224.214.195 with SMTP id hb3msqab;
        Fri, 22 Jun 2012 11:31:45 -0700 (PDT)
Received: by 10.52.19.110 with SMTP id d14mr229248vde.10.1340389904930;
        Fri, 22 Jun 2012 11:31:44 -0700 (PDT)
Date: Fri, 22 Jun 2012 11:31:44 -0700 (PDT)
From: Jon Wynveen <jonwynv...@gmail.com>
To: ravendb@googlegroups.com
Message-Id: <7592c20f-15a1-494a-89ee-9ee2e7f0f555@googlegroups.com>
In-Reply-To: <6734049.7.1335382820880.JavaMail.geo-discussion-forums@vbad20>
References: <0c0f01cd2308$50efdd60$f2cf9820$@ukcreativedesigns.com>
 <6734049.7.1335382820880.JavaMail.geo-discussion-forums@vbad20>
Subject: Re: Patch Request - Remove from array
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_595_12364286.1340389904366"

------=_Part_595_12364286.1340389904366
Content-Type: multipart/alternative; 
	boundary="----=_Part_596_3958835.1340389904366"

------=_Part_596_3958835.1340389904366
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I assume that would be the case for updating arrays as well, correct? I=20
have a user document with a Roles array on it that I want to update if the=
=20
role name changes. Do I need to just load each user, find the role, change=
=20
it, and store it for each user? Or is there a way to use the patching API=
=20
for this?

Here's my user document:
{
name: "username",
...,
roles: [
{id:"roles/1",name:"role1"},
{id:"roles/2",name:"role2"}
]
}

I'm only just getting started with Raven, so let me know if I'm structuring=
=20
this wrong.

On Wednesday, April 25, 2012 2:40:20 PM UTC-5, Matt Warren wrote:
>
> With the current patching API you can't do this, you have to tell it wher=
e=20
> in the array you want to make the change.
>
> You'll have to Load the doc, modify it in the client and then Store it=20
> again after.
>
> On Wednesday, 25 April 2012 18:24:48 UTC+1, Paul wrote:
>>
>> How can I do a patch request to remove a certain element from an array, =
I=20
>> know you can do it by position but I won=E2=80=99t know what the positio=
n is.
>>
>> It=E2=80=99s a simple IList<string>, I know the string to pass in.
>>
>> Paul
>>
>
------=_Part_596_3958835.1340389904366
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

I assume that would be the case for updating arrays as well, correct? I hav=
e a user document with a Roles array on it that I want to update if the rol=
e name changes. Do I need to just load each user, find the role, change it,=
 and store it for each user? Or is there a way to use the patching API for =
this?<div><br></div><div>Here's my user document:</div><div>{</div><div>nam=
e: "username",</div><div>...,</div><div>roles: [</div><div>{id:"roles/1",na=
me:"role1"},</div><div>{id:"roles/2",name:"role2"}</div><div>]</div><div>}<=
/div><div><br></div><div>I'm only just getting started with Raven, so let m=
e know if I'm structuring this wrong.<br><br>On Wednesday, April 25, 2012 2=
:40:20 PM UTC-5, Matt Warren wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: =
1ex;">With the current patching API you can't do this, you have to tell it =
where in the array you want to make the change.<br><br>You'll have to Load =
the doc, modify it in the client and then Store it again after.<br><br>On W=
ednesday, 25 April 2012 18:24:48 UTC+1, Paul  wrote:<blockquote class=3D"gm=
ail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;p=
adding-left:1ex"><div link=3D"blue" vlink=3D"purple" lang=3D"EN-GB"><div><p=
 class=3D"MsoNormal">How can I do a patch request to remove a certain eleme=
nt from an array, I know you can do it by position but I won=E2=80=99t know=
 what the position is.</p><p class=3D"MsoNormal"></p><p class=3D"MsoNormal"=
>It=E2=80=99s a simple IList&lt;string&gt;, I know the string to pass in.</=
p><p class=3D"MsoNormal"></p><p class=3D"MsoNormal">Paul</p></div></div></b=
lockquote></blockquote></div>
------=_Part_596_3958835.1340389904366--

------=_Part_595_12364286.1340389904366--