incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From qaqabincs <qaqabi...@gmail.com>
Subject Re: Re: how to use view with key
Date Tue, 02 Oct 2012 04:06:49 GMT
That's it! thanks for all. I misunderstood which one take the effect with the key...




qaqabincs

From: Kevin R. Coombes
Date: 2012-10-02 02:29
To: user
Subject: Re: how to use view with key
... and so, if you want to search by the project (name), you need to 
create another view that emits that field as the key ....

On 10/1/2012 1:17 PM, Robert Newson wrote:
> Your view is keyed on "doc.todo.submitTime" not "doc.todo.project".
>
> B.
>
> On 1 October 2012 18:02, qaqabincs<qaqabincs@gmail.com>  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
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message