Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 452B57761 for ; Thu, 14 Jul 2011 13:07:32 +0000 (UTC) Received: (qmail 29963 invoked by uid 500); 14 Jul 2011 13:07:31 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 29856 invoked by uid 500); 14 Jul 2011 13:07:30 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 29846 invoked by uid 99); 14 Jul 2011 13:07:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jul 2011 13:07:30 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jul 2011 13:07:24 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 1754E57A4A for ; Thu, 14 Jul 2011 13:07:03 +0000 (UTC) Date: Thu, 14 Jul 2011 13:07:03 +0000 (UTC) From: "Jason Smith (JIRA)" To: dev@couchdb.apache.org Message-ID: <1932228234.13235.1310648823092.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <399559220.12693.1310630522012.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (COUCHDB-1222) Naming convention: _id/_rev and id/rev MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/COUCHDB-1222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13065230#comment-13065230 ] Jason Smith commented on COUCHDB-1222: -------------------------------------- To quote a brilliant quotation of a brilliant dialogue: "The name of the song is called 'Haddocks' Eyes.'" "Oh, that's the name of the song is it?" Alice said trying to feel interested. "No. You don't understand," the Knight said, looking a little vexed. "That's what the name is *called*. The name really *is* 'The Aged Aged Man.'" "Then I ought to have said 'That's what the *song* is called'?" Alice corrected herself. "No, you oughtn't: that's quite another thing! The *song* is called 'Ways and Means': but that's only what it's *called*, you know!" "Well, what *is* the song, then?" said Alice, who was by this time completely bewildered. "I was coming to that," the Knight said. "The song really *is* 'A-sitting On A Gate': and the tune's my own invention." - Lewis Carroll, _Through the Looking Glass_ Originally quoted in Peter van der Linden's classic _Expert C Programming: Deep C Secrets_ (orange book, blue fish) They really *are* the "id" and the "rev". For some updates (_bulk_docs, PUT, POST), CouchDB will tell you, "The id is this, and the rev is that." Inside a document, you can use any field name you want, including "id" and "rev". CouchDB's special fields must start with underscore. Thus, inside a document, the id and rev are *called* "_id" and "_rev" respectively. To answer your immediate problem, if CouchDB returns "id" and "rev" you should *not* make a model out of that data because that is in fact *metadata* about the document. I think that is why there was never long-term pressure to make it consistent. (Also, IMHO, the "is" vs. "called" distinction does make sense, even if it confuses the development process a bit.) > Naming convention: _id/_rev and id/rev > -------------------------------------- > > Key: COUCHDB-1222 > URL: https://issues.apache.org/jira/browse/COUCHDB-1222 > Project: CouchDB > Issue Type: Improvement > Reporter: Johnny Weng Luu > Priority: Minor > > I'm using a MVC framework to communicate with CouchDB. > Sometimes CouchDB returns _id/_rev and other times id/rev. > Could either one of them be used instead, cause the model layer usually have pre set fields that can't be changed. > And this would also not confuse developers when they are parsing the result. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira