How to reference to doc ids in reduce() function in view


#1

I have a map function like this
map(doc, meta){
emit(doc.txId, null);
}

I want to get a list of doc ids by grouping on txId. How does my reduce function look like? Is emitting the doc id as value the only way to do that?

Thanks
Vincent


#2

Hello,

So yes if you need it, the only way that I know is to emit it as a value.

But why not query your index on the txId directly and get the list of id from the query instead of a reduce function?

If you do a query, on your index with a specific doc.txId it will return all doc ID for this tx no?

Regards
Tug
@tgrall