The following operation first sorts the documents by item and
date, and then in the following $group stage, groups
the now sorted documents by the item field and uses the
$last accumulator to compute the last sales date for each item: