public static function isInternalType($value)
    {
        if (!is_object($value)) {
            return false;
        }

        if (class_exists('\MongoDB\BSON\Type')) {
            // mongodb extension for PHP 7
            return $value instanceof \MongoDB\BSON\Type;
        } else {
            // legacy mongo extension for PHP 5
            $mongoTypes = array(
                'MongoId',
                'MongoCode',
                'MongoDate',
                'MongoRegex',
                'MongoBinData',
                'MongoInt32',
                'MongoInt64',
                'MongoDBRef',
                'MongoMinKey',
                'MongoMaxKey',
                'MongoTimestamp'
            );

            return in_array(
                get_class($value),
                $mongoTypes
            );
        }
    }
public static function isInternalType($value)
    {
        if (!is_object($value)) {
            return false;
        }

        if (class_exists('\MongoDB\BSON\Type')) {
            // mongodb extension for PHP 7
            return $value instanceof \MongoDB\BSON\Type;
        } else {
            // legacy mongo extension for PHP 5
            $mongoTypes = array(
                'MongoId',
                'MongoCode',
                'MongoDate',
                'MongoRegex',
                'MongoBinData',
                'MongoInt32',
                'MongoInt64',
                'MongoDBRef',
                'MongoMinKey',
                'MongoMaxKey',
                'MongoTimestamp'
            );

            return in_array(
                get_class($value),
                $mongoTypes
            );
        }
    }
public static function isInternalType ( $ value ) { if ( ! is_object ( $ value ) ) { return false ; } if ( class_exists ( '\MongoDB\BSON\Type' ) ) { // mongodb extension for PHP 7 return $ value instanceof \ MongoDB \ BSON \ Type ; } else { // legacy mongo extension for PHP 5 $ mongoTypes = array ( 'MongoId' , 'MongoCode' , 'MongoDate' , 'MongoRegex' , 'MongoBinData' , 'MongoInt32' , 'MongoInt64' , 'MongoDBRef' , 'MongoMinKey' , 'MongoMaxKey' , 'MongoTimestamp' ) ; return in_array ( get_class ( $ value ) , $ mongoTypes ) ; } }
Check if value belongs to internal Mongo type, converted by driver to scalars

@param mixed $value
@return bool
Check if value belongs to internal Mongo type converted by driver to scalars