From user-return-5553-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Thu Jul 16 23:44:29 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 24800 invoked from network); 16 Jul 2009 23:44:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 16 Jul 2009 23:44:28 -0000 Received: (qmail 6394 invoked by uid 500); 16 Jul 2009 23:45:33 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 6319 invoked by uid 500); 16 Jul 2009 23:45:33 -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 6309 invoked by uid 99); 16 Jul 2009 23:45:33 -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:45:33 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of tommy.chheng@gmail.com designates 209.85.146.179 as permitted sender) Received: from [209.85.146.179] (HELO wa-out-1112.google.com) (209.85.146.179) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jul 2009 23:45:22 +0000 Received: by wa-out-1112.google.com with SMTP id m38so90850waf.27 for ; Thu, 16 Jul 2009 16:45:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=iK5vmBrkQ7oXS14H+CyocfMaCDtSPD07JNu0t7X8Vh8=; b=OfQ8J7R/qM4OHWPcSYuMfMiTu9bwy9RmIy3WdI/dOzP/W4TtX9uit6rdM4x5LUhmez su5xP0kxw9BxCkeIv1gcHmc8pFg2GRirLoNK24tGxiu5dKjO0id6sTYbRFX1A/bU1AZH zA4QMadtd4nGUkGbGBqh2P1RoJRJbSWoIeKxE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=eXugnaWEjy3hrBP7gl4aWClwC6HfILJMD8wJYNIEnTXN4Qxj9vbGrXu4S02lPNUe/O w1JCwTK5UV6hsoV3S2d2VgNj5EIj2NZapirqcJEkJapfGInwFjb5CA+K/4G1/en3b9u3 bj3cSZtX0T5/7GH9ibmD61wj4VRwyZQf4biqM= Received: by 10.114.208.12 with SMTP id f12mr483762wag.226.1247787901142; Thu, 16 Jul 2009 16:45:01 -0700 (PDT) Received: from ?192.168.1.6? (ip72-219-190-157.oc.oc.cox.net [72.219.190.157]) by mx.google.com with ESMTPS id j31sm955195waf.68.2009.07.16.16.44.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 16 Jul 2009 16:45:00 -0700 (PDT) Message-Id: <870620CF-1094-404D-868D-CC6D9034F376@gmail.com> From: Tommy Chheng To: user@couchdb.apache.org In-Reply-To: <20fefa50907161643q2c5814d7s43f55e1796d9e563@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Subject: Re: delete key value pair? Date: Thu, 16 Jul 2009 16:42:45 -0700 References: <56B1CF18-683F-4637-A3BC-932ADE038A03@gmail.com> <20fefa50907161637l48f5fab3p9c191426f64998b6@mail.gmail.com> <20fefa50907161643q2c5814d7s43f55e1796d9e563@mail.gmail.com> X-Mailer: Apple Mail (2.935.3) X-Virus-Checked: Checked by ClamAV on apache.org It worked, i'll be sure to subscribe to the couchrest mailing list as well. On Jul 16, 2009, at 4:43 PM, Matt Aimonetti wrote: > 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 >>>>>> >>>>>> >>>>> >>>> >>