Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 23139 invoked from network); 16 Jul 2009 23:43:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 16 Jul 2009 23:43:02 -0000 Received: (qmail 3554 invoked by uid 500); 16 Jul 2009 23:44:06 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 3486 invoked by uid 500); 16 Jul 2009 23:44:06 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 3476 invoked by uid 99); 16 Jul 2009 23:44:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jul 2009 23:44:06 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mattaimonetti@gmail.com designates 209.85.210.204 as permitted sender) Received: from [209.85.210.204] (HELO mail-yx0-f204.google.com) (209.85.210.204) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jul 2009 23:43:57 +0000 Received: by yxe42 with SMTP id 42so820725yxe.13 for ; Thu, 16 Jul 2009 16:43:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=qkjWphFe59IHh6mR9+sVvmpPmYNc+AsJ+9pkzauJZYk=; b=K/W6naPCsPp5/7pRa+3nuM/gMDcyxxJ6+FXN9Xw8A/b4PNw49+UzVRRgXH51u8tQGI hf0F//WZ3rraN5YMTxu9SZX+tEtjzChN+ukPnBmyUaX/KQAaM2fuBTY5GPk2ob0FZ5+f uadNFozoqTXTsxzw6vdaivGKwmjFe5Ow/NaYE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=bSDlfaxGIy9GGEAGCl0u6GFrni3Xge1bSWK7OnrU3Q3LMVLx0wwUM8EehxeJ/QWUMv 0F27egUAe0TkxHI6aWN87sDyNHw6RITzxg8cpDLBEEShJyZlUHgH+W4nvvdvG8vbNV8u RnzC4J5maq8Ix1OgJqWTXXJyUIjZYz8FlLT1A= MIME-Version: 1.0 Received: by 10.150.58.14 with SMTP id g14mr747373yba.264.1247787815224; Thu, 16 Jul 2009 16:43:35 -0700 (PDT) In-Reply-To: References: <56B1CF18-683F-4637-A3BC-932ADE038A03@gmail.com> <20fefa50907161637l48f5fab3p9c191426f64998b6@mail.gmail.com> Date: Thu, 16 Jul 2009 16:43:34 -0700 Message-ID: <20fefa50907161643q2c5814d7s43f55e1796d9e563@mail.gmail.com> Subject: Re: delete key value pair? From: Matt Aimonetti To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=000e0cd341d67b5974046edb3d15 X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd341d67b5974046edb3d15 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Let us know if it doesn't work for you. Also we have a special CouchRest mailing list. You might want to ask CouchRest specific questions over there. Thanks, - Matt On Thu, Jul 16, 2009 at 4:38 PM, Tommy Chheng wrote: > Great, thanks for the help! > > tommy > > > On Jul 16, 2009, at 4:37 PM, Matt Aimonetti wrote: > > Try: >> >> Person.all.each do |p| >> p[:name] = "#{p[:first_name]} #{p[:last_name]}" >> p.delete(:first_name) >> p.delete(:last_name) >> p.save >> end >> >> If not try using a string key instead of a symbol: p.delete('first_name') >> >> Also, make sure to remove the first_name and last_name properties in your >> model. >> >> - Matt >> >> >> >> On Thu, Jul 16, 2009 at 4:30 PM, Tommy Chheng > >wrote: >> >> I'm using Ruby/CouchRest >>> >>> I tried this way but setting it to nil only sets the value to null >>> Person.all.each do |p| >>> p[:name] = "#{p[:first_name]} #{p[:last_name]}" >>> p[:first_name] = nil >>> p[:last_name] = nil >>> p.save >>> end >>> >>> if i don't assign the first_name, it'll just be the previous value. >>> >>> Thanks, >>> Tommy >>> >>> >>> On Jul 16, 2009, at 4:29 PM, Zachary Zolton wrote: >>> >>> Sure, but it'd just be a regular document update (PUT), requiring you to >>> >>>> GET the entire document first, so you've got the rest of the fields and >>>> an >>>> up-to-date revision. >>>> >>>> Which language/library are you using? Perhaps someone here will produce >>>> an >>>> example. >>>> >>>> >>>> On Jul 16, 2009, at 6:16 PM, Tommy Chheng >>>> wrote: >>>> >>>> How can i delete just a key-value pair but not the whole document? >>>> >>>>> >>>>> Ex: { "first_name": "blah", "last_name": "last"} , i want to delete >>>>> the >>>>> kv pair "first_name": "blah" but not the whole document. >>>>> >>>>> >>>>> Thanks, >>>>> Tommy >>>>> >>>>> >>>> >>> > --000e0cd341d67b5974046edb3d15--