Hopefully the necessary changes are clear from the ticket description: the aggregate command now accepts an optional string "comment" parameter, similar to the existing comment parameter of the find command, which the user can set to an arbitrary string value to help trace the operation through the profiler, currentOp and logs. Please feel free to ask me if any further details are needed.
In order to help users trace output in the logs, the system.profile collection, and db.currentOp() back to their application behavior, we should extend the aggregation command to accept a comment parameter:
We should require at command parsing time that the comment is a string. Its diagnostic display in the logs/profile/currentOp should be consistent with that for the find command's comment parameter, documented here.