Pankaj, switch the order of the key you use for this:
emit([doc.group, doc.date], doc);
You can then pass the start key and the final key when requesting a view. Perhaps it would be easier to make a separate request for each group for which you want to receive data. Data will be sorted by date.
I am on the way now, but I can clarify when I will return, if this is not clear.
source
share