Received: by 10.213.30.7 with SMTP id s7mr963748ebc.21.1285336240090; Fri, 24 Sep 2010 06:50:40 -0700 (PDT) X-BeenThere: mongodb-user@googlegroups.com Received: by 10.213.43.207 with SMTP id x15ls909687ebe.1.p; Fri, 24 Sep 2010 06:50:27 -0700 (PDT) Received: by 10.213.44.138 with SMTP id a10mr1593370ebf.8.1285336227610; Fri, 24 Sep 2010 06:50:27 -0700 (PDT) Received: by 10.213.44.138 with SMTP id a10mr1593369ebf.8.1285336227585; Fri, 24 Sep 2010 06:50:27 -0700 (PDT) Return-Path: Received: from mail-ey0-f181.google.com (mail-ey0-f181.google.com [209.85.215.181]) by gmr-mx.google.com with ESMTP id r57si2239119eeh.5.2010.09.24.06.50.27; Fri, 24 Sep 2010 06:50:27 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.181 is neither permitted nor denied by best guess record for domain of m...@10gen.com) client-ip=209.85.215.181; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 209.85.215.181 is neither permitted nor denied by best guess record for domain of m...@10gen.com) smtp.mail=m...@10gen.com Received: by eyf6 with SMTP id 6so848878eyf.12 for ; Fri, 24 Sep 2010 06:50:27 -0700 (PDT) Received: by 10.213.8.212 with SMTP id i20mr223792ebi.35.1285336227368; Fri, 24 Sep 2010 06:50:27 -0700 (PDT) Return-Path: Received: from mail-ey0-f178.google.com (mail-ey0-f178.google.com [209.85.215.178]) by mx.google.com with ESMTPS id u9sm3115311eeh.11.2010.09.24.06.50.25 (version=SSLv3 cipher=RC4-MD5); Fri, 24 Sep 2010 06:50:26 -0700 (PDT) Received: by eyh6 with SMTP id 6so893178eyh.23 for ; Fri, 24 Sep 2010 06:50:25 -0700 (PDT) Received: by 10.213.35.129 with SMTP id p1mr3136538ebd.44.1285336225225; Fri, 24 Sep 2010 06:50:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.213.14.138 with HTTP; Fri, 24 Sep 2010 06:50:04 -0700 (PDT) In-Reply-To: <42f27df6-3c33-4e05-a0d1-fa8807c1042d@y31g2000vbt.googlegroups.com> References: <508bde00-7c2d-4d2e-b445-9352f623c...@k30g2000vbn.googlegroups.com> <42f27df6-3c33-4e05-a0d1-fa8807c10...@y31g2000vbt.googlegroups.com> From: Michael Dirolf Date: Fri, 24 Sep 2010 09:50:04 -0400 Message-ID: Subject: Re: [mongodb-user] Re: Atomic update to embedded array item To: mongodb-user@googlegroups.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Yes. Add something to the query document to select the post you want to upd= ate. On Fri, Sep 24, 2010 at 09:48, Ash wrote: > thanks, > > can i do that particular update that will only affect a specific post? > > On Sep 24, 2:44=C2=A0pm, Michael Dirolf wrote: >> Use the positional ($) modifier. So something like: >> update({"comments.id": 2}, {$set: {"comments.$.name": "foo"}}) >> >> >> >> On Fri, Sep 24, 2010 at 09:07, Ash wrote: >> > How can update an embedded array item using atomic update >> >> > e.g. posts -> comments >> >> > i would like to update a comment which has id of 2 by change the >> > comment name >> >> > -- >> > You received this message because you are subscribed to the Google Gro= ups "mongodb-user" group. >> > To post to this group, send email to mongodb-user@googlegroups.com. >> > To unsubscribe from this group, send email to mongodb-user+unsubscribe= @googlegroups.com. >> > For more options, visit this group athttp://groups.google.com/group/mo= ngodb-user?hl=3Den. > > -- > You received this message because you are subscribed to the Google Groups= "mongodb-user" group. > To post to this group, send email to mongodb-user@googlegroups.com. > To unsubscribe from this group, send email to mongodb-user+unsubscribe@go= oglegroups.com. > For more options, visit this group at http://groups.google.com/group/mong= odb-user?hl=3Den. > >