Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 40643 invoked from network); 6 Mar 2009 19:26:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Mar 2009 19:26:04 -0000 Received: (qmail 52162 invoked by uid 500); 6 Mar 2009 19:26:00 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 52132 invoked by uid 500); 6 Mar 2009 19:26:00 -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 52110 invoked by uid 99); 6 Mar 2009 19:26:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Mar 2009 11:26:00 -0800 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 tkruthoff@gmail.com designates 209.85.198.224 as permitted sender) Received: from [209.85.198.224] (HELO rv-out-0506.google.com) (209.85.198.224) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Mar 2009 19:25:51 +0000 Received: by rv-out-0506.google.com with SMTP id f6so598958rvb.35 for ; Fri, 06 Mar 2009 11:25:29 -0800 (PST) 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=eqtZu/0/QCncSlcbh96PGDRSghSoWO8pvuFHc30nSuA=; b=aBT97W8sKtwvTZY2uioPM1jnqg7nLRo3cZ086gbaYqbLqclBVhzJTSofGwm9Vrgvii yewdTUz13XjeWnWz6F88w7NdhfjsmmMj8HOcl7Tg0XBl1Xfm4PC4zfcylL3DgFtRdvTv nhSo6XUrEHvWwOkKnphFlTh6ezRXr5QUsXYEQ= 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=LfzBxpv8YPpzIhDvSXHEYdp1qfAqCvmdxcT3aPCrTvJtsdc+CzrA39XOlCuBCH90Uu WVcbojD2c06p6RSh0tb2fnAnfIB5X8zkD3ViDlENOwuEcwT8DShq2TsqrIqL/P50TwH+ 9Mp85yNZCJuDznMYi4P7c/ISswzw+1LHd1jNc= Received: by 10.141.2.18 with SMTP id e18mr1433962rvi.142.1236367529889; Fri, 06 Mar 2009 11:25:29 -0800 (PST) Received: from ?10.0.1.205? ([67.159.148.212]) by mx.google.com with ESMTPS id f21sm4202600rvb.2.2009.03.06.11.25.29 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 06 Mar 2009 11:25:29 -0800 (PST) Message-Id: From: Troy Kruthoff To: user@couchdb.apache.org In-Reply-To: <49B165E3.4040801@proven-corporation.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: Best way to "migrate" (a la Rails) Couch documents Date: Fri, 6 Mar 2009 11:25:27 -0800 References: <49B165E3.4040801@proven-corporation.com> X-Mailer: Apple Mail (2.930.3) X-Virus-Checked: Checked by ClamAV on apache.org On Mar 6, 2009, at 10:05 AM, Jason Smith wrote: > Hi, list. > > While I am happy to be learning Couch for a new project, I am still > unsure about some tricks that I used with Django and Rails, such as > data migration: > > For example, suppose I change my code and instead of using a string > timestamp in my documents, I would prefer a hash with "day", > "month", and "year" keys. When I deploy the new code into > production, obviously I want the data structures to change for all > existing documents. > Also keep in mind that another option is to "wrap" your json docs in a language specific object for access, and you can use this layer to this transformation at runtime and leave the data alone. As for querying, couch allows you to emit values to a view (such as a d/m/y hash) instead of the timestamp. This has the obvious advantage of immediate deployment without first having to do a migration. Which by the way, is very similar to how attribs can be added or removed, without touching the actual data store. -- troy