About using explain() and hint()

How can i use explain() and hint() commands in a pipeline?
Must i analyze each single stage into db.collection.aggreate()?
Wich stage does it support these commands?
For example ( i think )
$match lookslike find()
$sort is the same as .sort()
$group looks like .sort()

Thanks for the aid


Note that the documentation on the aggregate command here has an ‘explain’ boolean that I think probably does what you want. The ‘hint’ option is not available for the aggregation pipeline as far as I know, HTH.