Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BECF96BD2 for ; Sun, 22 May 2011 07:29:01 +0000 (UTC) Received: (qmail 46921 invoked by uid 500); 22 May 2011 07:28:59 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 46752 invoked by uid 500); 22 May 2011 07:28:57 -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 46744 invoked by uid 99); 22 May 2011 07:28:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 22 May 2011 07:28:57 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [178.77.98.152] (HELO beberlei.de) (178.77.98.152) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 22 May 2011 07:28:49 +0000 Received: from benny-pc (koln-4d0dc6a0.pool.mediaWays.net [77.13.198.160]) by beberlei.de (Postfix) with ESMTPSA id 0B0006E0911B for ; Sun, 22 May 2011 09:28:27 +0200 (CEST) Date: Sun, 22 May 2011 09:28:25 +0200 From: Benjamin Eberlei To: user@couchdb.apache.org Subject: Updating documents for a change in application model Message-ID: <20110522092825.5656f609@benny-pc> X-Mailer: Claws Mail 3.7.8 (GTK+ 2.24.4; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hello, i have searched the net for a while now and haven't found a good resource on how to handle large scale refactorings in the application model with a CouchDB backend. So far I thought about using one of the following two different approaches: 1. Eventually migrate the data when it comes "into memory" by saving a version field for example. This however does not work for refactorings that change keys in views. Also it leads to lots of IF version then else code in your model that is really ugly to maintain in the long-run. 2. Use _all_docs to iterate over all documents, detect the ones that need changes and do them. This can probably take a while if you have lots of documents and never trigger all_docs during the "normal" application lifetime. The first approach may sound good at the beginning but i only see very few use-cases for it other than changing names of fields that are not part of a view key. Can someone maybe share his experience with regard to point 2 or variations of point 2? Additionally, are there solutions for refactoring CouchDB documents I forgot? greetings, Benjamin