Modify the aggregation logic to handle keys for subdocuments.

See issue #28.

To me it appears that the tests pass but it gets hung up and hard to tell if those tests were skipped, returned errors, or what.