From user-return-19084-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Sat Dec 10 01:06:05 2011 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 A2E057AC1 for ; Sat, 10 Dec 2011 01:06:05 +0000 (UTC) Received: (qmail 84711 invoked by uid 500); 10 Dec 2011 01:06:04 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 84663 invoked by uid 500); 10 Dec 2011 01:06:04 -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 84655 invoked by uid 99); 10 Dec 2011 01:06:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Dec 2011 01:06:04 +0000 X-ASF-Spam-Status: No, hits=-0.1 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [128.18.84.113] (HELO mailgate-internal3.sri.com) (128.18.84.113) by apache.org (qpsmtpd/0.29) with SMTP; Sat, 10 Dec 2011 01:05:54 +0000 Received: from brightmail-internal1.sri.com (128.18.84.121) by mailgate-internal3.sri.com with SMTP; 10 Dec 2011 01:05:31 -0000 X-AuditID: 80125479-b7c61ae000000cd9-ac-4ee2b05b67d3 Received: from mars.esd.sri.com (mars.esd.sri.com [128.18.26.200]) by brightmail-internal1.sri.com (Symantec Brightmail Gateway) with SMTP id 6E.98.03289.B50B2EE4; Fri, 9 Dec 2011 17:05:31 -0800 (PST) MIME-version: 1.0 Content-type: multipart/alternative; boundary="Boundary_(ID_9TgVqcx3nx1BuMlavYScsQ)" Received: from [192.12.16.233] by mars.esd.sri.com (Sun Java(tm) System Messaging Server 6.3-8.05 (built Sep 1 2009; 64bit)) with ESMTPSA id <0LVY0032FR0Z6R90@mars.esd.sri.com> for user@couchdb.apache.org; Fri, 09 Dec 2011 17:05:24 -0800 (PST) From: Jim Klo Subject: Re: How to get only a field in a document Date: Fri, 09 Dec 2011 17:05:30 -0800 In-reply-to: To: user@couchdb.apache.org References: Message-id: <73E990F6-8739-4E25-9C83-02686BB16B7B@sri.com> X-Mailer: Apple Mail (2.1084) X-Brightmail-Tracker: AAAAAA== X-Virus-Checked: Checked by ClamAV on apache.org --Boundary_(ID_9TgVqcx3nx1BuMlavYScsQ) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT if you know the document ID that you're after, then a show function can handle what you're asking without a view: http://guide.couchdb.org/draft/show.html Jim Klo Senior Software Engineer Center for Software Engineering SRI International On Dec 9, 2011, at 4:10 PM, jack chrispoo wrote: > Hi all, > > I am new to CouchDB and I have a question about getting data in documents. > I have documents like below: > > { > "field1":"value1", > "field2":"value2", > .... > } > > The documents have a lot of fields and in one case I only want to get > field1 from the documents. I'm wondering if there is a way to avoid getting > the entire document from CouchDB server because this involves a lot of > unnecessary data transmission over the network? I tried creating a view > which emits (doc._id,{"field1": doc.fleid1}), but indexing the view takes > really long, and it doesn't seem to improve the performance. So I'm curious > if there is an easier way to get only a field out of a document. > > Thanks > > jack --Boundary_(ID_9TgVqcx3nx1BuMlavYScsQ)--