It turns out there is a "stupid trick" for that. You can use "$project" stage to output a new field which tells you whether or not another field is an array like this:
What's the point of doing this, other than just "for fun"? Well, it turns out there are some operators which only work on arrays and if you try to use them on non-arrays you will get an error. One of them in "$unwind" stage, another is the new in 2.6 "$size" operator which returns the size of an array field, but gives an error if the field is not an array.
Of course the '$size' operator is quite handy in much simpler scenarios where you might be creating an array of unique values during a '$group' stage using'$addToSet' and then you can use '$size' to find out how many unique values ended up being accumulated in that array.
For those looking forward to other new features of aggregation in 2.6 I figured I'd show an alternate way to do this with only a single "$project" stage, instead of three in sequence above:
I hope you enjoy some of the new 2.6 aggregation enhancements - I will probably continue writing about them, as they make some of our old tricks unnecessary, but open the door to a whole new set of tricks to come!