This code
const bool isUUID = (element.canonicalType() == canonicalizeBSONType(mongo::BinData) &&
can be simplified by just using type().
The other call
element.canonicalType() == canonicalizeBSONType(mongo::String)
can be simplified to
type() == Symbol || type == String
Same simplification can be done to CommandHelpers::parseNsCollectionRequired.