Reputation: 1217
I'm trying to get benefits of view collation in CouchDB unsuccessfully, could some one please check what's wrong in my case?
First, I'm basing on http://www.cmlenz.net/archives/2007/10/couchdb-joins
Then, I want to implement tree, linked by parent_id, e.g.:
|- Li
|- test
|- tester
which in CouchDB is:
{"_id":"root","name":"Li","completed":true},
{"_id":"102ef7e2e99db3983a3bb60a490015db","parent_id":"root","name":"test","completed":false},
{"_id":"102ef7e2e99db3983a3bb60a4900209e","parent_id":"102ef7e2e99db3983a3bb60a490015db","name":"tester","completed":false}
So, I have the following view defined:
items : {
map : function(doc){
emit([doc._id, 0], doc);
emit([doc.parent_id, 1], doc);
}
}
And expect query for startKey=["root"] return just two documents root and it's only direct child, but query returns all (doubled) documents, i.e. filtering by key does not work for me.
What can be the problem?
You can see DB at http://yo.iriscouch.com/_utils/database.html?cats
Then query http://yo.iriscouch.com/cats/_design/app/_view/items?startKey=[%22root%22] return exactly the same as without any arguments, i.e. it looks like startKey is ignored.
I've tried startKey=["root", 0]&endKey=["root", 2] also without any luck.
Thank you.
Upvotes: 1
Views: 711
Reputation: 4631
It's 'startkey' not 'startKey' (note case).
http://wiki.apache.org/couchdb/HTTP_view_API#Querying_Options
Upvotes: 2