[ https://issues.apache.org/jira/browse/COUCHDB-3321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15904649#comment-15904649 ]
Will Holley commented on COUCHDB-3321: -------------------------------------- [~thaina] have you looked at [Mango/Query|http://docs.couchdb.org/en/2.0.0/api/database/find.html] in Couch 2.0? It looks like a query along the lines of: {code} { "selector": { "$or": [{"user": "a"}, {"user": "b"}] } {code} would give you the desired behaviour. > group_level=docid > ----------------- > > Key: COUCHDB-3321 > URL: https://issues.apache.org/jira/browse/COUCHDB-3321 > Project: CouchDB > Issue Type: Improvement > Components: HTTP Interface, JavaScript View Server > Reporter: Thaina Yu > > I think it would be useful for include_docs=true on mapreduce view if we > could group by DocID before returning document content > Suppose we have document that relate to multiple user > {code:javascript} > doc1 : { users : ["a","b"] , content : { bigData } } > doc2 : { users : ["b","c"] , content : { bigData } } > doc3 : { users : ["a","c"] , content : { bigData } } > doc4 : { users : ["a","b","c"] , content : { bigData } } > {code} > So we emit view each row for each user > {code:javascript} > { doc : "doc1" , key : "a" } > { doc : "doc3" , key : "a" } > { doc : "doc4" , key : "a" } > { doc : "doc1" , key : "b" } > { doc : "doc2" , key : "b" } > { doc : "doc4" , key : "b" } > { doc : "doc2" , key : "c" } > { doc : "doc3" , key : "c" } > { doc : "doc4" , key : "c" } > {code} > And then we query document of a and b > {code} > _design/MyDesign/_view/MyView?include_docs=true&keys=a,b > {code} > It will return duplicate of doc1 which is unnecessary > I wish we could specify group_level=docid so it will group value with > document and return only one unique document -- This message was sent by Atlassian JIRA (v6.3.15#6346)