Doctrine\MongoDB\Query\Expr::type PHP Method

type() public method

Specify $type criteria for the current field.
See also: Builder::type()
See also: http://docs.mongodb.org/manual/reference/operator/type/
public type ( integer $type )
$type integer
    public function type($type)
    {
        if (is_string($type)) {
            $map = ['double' => 1, 'string' => 2, 'object' => 3, 'array' => 4, 'binary' => 5, 'undefined' => 6, 'objectid' => 7, 'boolean' => 8, 'date' => 9, 'null' => 10, 'regex' => 11, 'jscode' => 13, 'symbol' => 14, 'jscodewithscope' => 15, 'integer32' => 16, 'timestamp' => 17, 'integer64' => 18, 'maxkey' => 127, 'minkey' => 255];
            $type = isset($map[$type]) ? $map[$type] : $type;
        }
        return $this->operator('$type', $type);
    }

Usage Example

示例#1
0
 /**
  * Specify $type criteria for the current field.
  *
  * @see Expr::type()
  * @see http://docs.mongodb.org/manual/reference/operator/type/
  * @param integer $type
  * @return self
  */
 public function type($type)
 {
     $this->expr->type($type);
     return $this;
 }
All Usage Examples Of Doctrine\MongoDB\Query\Expr::type