incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tommy Chheng <tommy.chh...@gmail.com>
Subject Re: delete key value pair?
Date Thu, 16 Jul 2009 23:30:06 GMT
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 <tommy.chheng@gmail.com>  
> 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


Mime
View raw message