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 F2377D8B8 for ; Mon, 1 Oct 2012 18:17:28 +0000 (UTC) Received: (qmail 28924 invoked by uid 500); 1 Oct 2012 18:17:27 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 28883 invoked by uid 500); 1 Oct 2012 18:17:27 -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 28875 invoked by uid 99); 1 Oct 2012 18:17:27 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Oct 2012 18:17:27 +0000 Received: from localhost (HELO mail-vb0-f52.google.com) (127.0.0.1) (smtp-auth username rnewson, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Oct 2012 18:17:27 +0000 Received: by vbjk17 with SMTP id k17so5261371vbj.11 for ; Mon, 01 Oct 2012 11:17:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.58.13.33 with SMTP id e1mr8839478vec.51.1349115445613; Mon, 01 Oct 2012 11:17:25 -0700 (PDT) Received: by 10.52.98.231 with HTTP; Mon, 1 Oct 2012 11:17:25 -0700 (PDT) In-Reply-To: <201210020102190275925@gmail.com> References: <201210020102190275925@gmail.com> Date: Mon, 1 Oct 2012 19:17:25 +0100 Message-ID: Subject: Re: how to use view with key From: Robert Newson To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Your view is keyed on "doc.todo.submitTime" not "doc.todo.project". B. On 1 October 2012 18:02, qaqabincs wrote: > dear all, > > I have a view named as "todolist" such like: > > function(doc) { > if (doc.todo.project){ > emit(doc.todo.submitTime,doc); > } > } > > and the todo structure such as follow: > > todo: { > content: "something", > project: "aproject" > } > > and I use couchdb.js to access my couchdb server: > > db.view("foo/todolist", { > success: function(data){console.log(data);}, > key: "aproject", > reduce: false > })' > > but as I have there document that has element project with value "aproject", but the return data is null. > > who can tell me what happened? I use CouchDB 1.1.1. > > > > > qaqabincs