Given a couponbase JSON document, for example, collections of milestones similar to this:
{ "milestoneDate" : /Date(1335191824495+0100)/, "companyId" : 43, "ownerUserId": 475, "participants" : [ { "userId": 2, "docId" : "132546" }, { "userId": 67, "docId" : "153" } ] }
If I chose all the stages of company 43 and would like to order them according to the latest data ... my view on couchbase would look like this:
function (doc, meta) { if(doc.companyId && doc.milestoneDate) {
I get both dates and company id on the remaining URLs. However, being completely new to couchbase, I cannot decide how to limit the presentation to returning only company stages 43
The return key is similar to this:
"key":[2013,6,19,16,11,25,14]
where the last element ( 14 ) is the company identifier. This is clearly wrong.
The request parameters I tried:
&descending=true&startkey=[{},43]&descending=true&startkey=[{},43]&endKey=[{},43]- tried to add companyId to
value , but could not limit the return results by value.
And according to couchbase documentation, I need the date details at the beginning to sort them. How can I limit them to company ID, please?
thanks.