Details
Description
When running an aggregation pipeline over a view, we build the new AggregateCommandRequest with the resolved view and the original user-provided request. We then serialize the AggregateCommandRequest into a BSON cmdObj (here). In the IDHack path, this serialization takes somewhere around 1-2% of the query time, but the resulting cmdObj isn't actually necessary until a cursor is opened. We can avoid this time spent serializing if the results fit in one batch.