couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Smith <>
Subject Re: Best way to "migrate" (a la Rails) Couch documents
Date Fri, 06 Mar 2009 18:25:44 GMT
Chris Anderson wrote:
> On Fri, Mar 6, 2009 at 10:05 AM, Jason Smith <> wrote:
>> 1. Fetch _all_docs
>> 2. For each document that requires changing, modify it
>> 3. Either PUT the new documents up one by one, or POST them to _bulk_docs,
>> depending on the situation.
>> This solution doesn't strike me as particularly horrible, but I was
>> wondering if there is a better way, perhaps something server-side.
> This is basically the way to do it. If you want to be sure you've got
> it right, the thing to do is create a view that emits for all docs
> with the old timestamp format. Then you can process docs from that
> view, until it is empty. This way you can be sure no docs slip through
> the cracks.

Thanks very much.  Perhaps I'll post to the list when I have something. 
  Have you considered having couchapp play a part here?  (I'm just 
thinking out loud, but for example, what if the user wrote the core 
migration code in Javascript as he would for views, and couchapp 
facilitated the migration taking place in the user's browser?)

Jason Smith
Proven Corporation
Bangkok, Thailand

View raw message