Generating a view to group sales by product within a date range

I am currently using Couchbase 3.x but within a week or so will be upgrading to 4.x.

In our database we have order objects that contain 1 or more items in each. From these objects, I am trying to produce a report that shows sales by product for a given date range.

I am struggling to produce this using a view and wonder if perhaps it is not possible. I can produce a report of total sales for a given date range (map / reduce on the order total and use the date as a compound key) and I can produce a report of sales by product for all dates, but I can’t figure out how to group by item_id but limit to a supplied date range.

Is such a view possible? Thanks in advance for any advice.