Get the documents where the value of a $field may be something else

@param	array	$wheres		an associative array with conditions, array(field => value)
@usage	$mongodb->orWhere(array( array('foo'=>'bar', 'bar'=>'foo' ))->get('foobar');
431286
public function orWhere($wheres = array())
		{
			if (count($wheres) > 0) {
				if ( ! isset($this->wheres['$or']) or ! Arrays::is($this->wheres['$or'])) {
					$this->wheres['$or'] = array();
				}

				foreach ($wheres as $wh => $val) {
					$this->wheres['$or'][] = array($wh => $val);
				}
			}

			return $this;
		}
484585
public function findWhere(array $where, $columns = ['*'])
    {
        $fields = array_keys($where);
        $fields = $this->getColumnsNames($fields);

        return parent::findWhere(
            array_combine($fields, array_values($where)),
            $this->getColumnsNames($columns)
        );
    }
159809
private function getSearchQueryWhere($query, $where)
	{
		foreach ($where as $key => $value) {
			$query->where($value[0], $value[1], $value[2]);
		}

		return $query;
	}
1254076
public function whereHas($relation, array $where = [], array $whereHas = [], array $with = [])
    {
        $query = $this->make($with);

        $query = $this->applyWhere($query, $where);

        $query = $query->whereHas($relation, function ($q) use ($whereHas) {
            $this->applyWhere($q, $whereHas);
        });

        return $query->get();
    }
465952
public function where_in($field, array $values, $not=FALSE){
        if($this->where != ''){$this->where.='AND ';}
        $this->in($field, $values, $not);       
    }
339932
public function where($where,$parse=null){
        if(!is_null($parse) && is_string($where)) {
            if(!is_array($parse)) {
                $parse = func_get_args();
                array_shift($parse);
            }
            $parse = array_map(array($this->db,'escapeString'),$parse);
            $where =   vsprintf($where,$parse);
        }elseif(is_object($where)){
            $where  =   get_object_vars($where);
        }
        if(is_string($where) && '' != $where){
            $map    =   array();
            $map['_string']   =   $where;
            $where  =   $map;
        }        
        if(isset($this->options['where'])){
            $this->options['where'] =   array_merge($this->options['where'],$where);
        }else{
            $this->options['where'] =   $where;
        }
        
        return $this;
    }
1087814
public function where($where)
    {
        $where = LambdaUtils::toConditionCallable($where);
        $collection = $this->newInstance();
        foreach($this as $record)
        {
            if(call_user_func($where, $record))
            {
                $collection->add($record);
            }
        }
        return $collection;
    }
1076301
protected function whereConditions(array $wheres): string
	{
		$conditions = [];

		$conditionCounter = 0;

		foreach($wheres as $where)
		{
			$conditions[] = ($conditionCounter > 0 ? $where['separator'] . ' ' : null) . $this->{$where['type']}($where);

			$conditionCounter++;
		}

		return implode(' ', $conditions);
	}
891848
public static function dbField($table, $field, $where) {

        $fldValue = "";
        $row = self::dbRow($table, ['type'=>'num', 'fl'=>$field, 'where'=>$where]);
        if (!empty($row)) {
            list($fldValue) = $row;
        }
        return $fldValue;
    }
952155
public function findWhereNotIn($field, array $values, $columns = ['*'])
    {
        $this->applyCriteria();
        $this->applyScope();
        $model = $this->model->whereNotIn($field, $values)->get($columns);
        $this->resetModel();

        return $this->parserResult($model);
    }
1368849
static  function find($list, $where) {
        if (is_array($where)) {
            foreach ($list as $item) {
                $is_ok = true;
                foreach ($where as $key => $value) {
                    if ($item[ $key ] != $value) {
                        $is_ok = false;
                        break;
                    }
                }
                if ($is_ok) {
                    return $item;
                }
            }
        } else {
            foreach ($list as $item) {
                if ($where($item)) {
                    return $item;
                }
            }
        }
        return null;
    }
1189127
protected static function parseWhere($where)
    {
        if (is_array($where) && key($where) !== 0) {
            $item = [];
            foreach ($where as $key => $val) {
                $item[] = [$key, '=', $val];
            }
            return $item;
        }
        return $where;
    }
1024001
public function where($where, &$params)
    {
        if (!is_array($where)) {
            throw new \Exception("Invalid where clause specified, must be an array");
        }

        $params = Helper::toArray($params);

        $query = "";

        $andFlag = false;

        foreach ($where as $field => $value) {

            # Add the and flag if this isn't the first field
            if ($andFlag) {
                $query .= "AND ";
            } else {
                $andFlag = true;
            }

            # Add the field name to the query
            $query .= $this->quoteField($field);

            # Convert arrays to use the in helper
            if (is_array($value)) {
                $helperMap = [
                    "<"     =>  "lessThan",
                    "<="    =>  "lessThanOrEqualTo",
                    ">"     =>  "greaterThan",
                    ">="    =>  "greaterThanOrEqualTo",
                    "="     =>  "equals",
                    "<>"    =>  "notEqualTo",
                ];
                $clause = (string) reset($value);
                if (count($value) === 2 && isset($helperMap[$clause])) {
                    $method = $helperMap[$clause];
                    $val = next($value);
                    trigger_error("Using arrays for complex where clauses is deprecated in favour of the helper methods, eg Sql::" . $method . "(" . $val . ")", E_USER_DEPRECATED);
                    $value = static::$method($val);
                } else {
                    $value = static::in($value);
                }
            }

            # Any parameters not using a helper should use the standard equals helper
            if (!is_object($value)) {
                $value = static::equals($value);
            }

            $query .= " " . $value->getClause() . " ";
            foreach ($value->getValues() as $val) {
                $params[] = $val;
            }
        }

        return $query;
    }
1217850
public function findWhere($where, $columns = ['*'], $or = false)
    {
        return $this->postProcess( parent::findWhere($where, $columns, $or) );
    }
1209322
public function parseWhere($where)
    {
        if (empty($where)) {
            $where = [];
        }

        $filter = [];
        foreach ($where as $logic => $val) {
            foreach ($val as $field => $value) {
                if ($value instanceof \Closure) {
                    // 使用闭包查询
                    $query = new MongoQuery($this->connection);
                    call_user_func_array($value, [& $query]);
                    $filter[$logic][] = $this->parseWhere($query->getOptions('where'));
                } else {
                    if (strpos($field, '|')) {
                        // 不同字段使用相同查询条件（OR）
                        $array = explode('|', $field);
                        foreach ($array as $k) {
                            $filter['$or'][] = $this->parseWhereItem($k, $value);
                        }
                    } elseif (strpos($field, '&')) {
                        // 不同字段使用相同查询条件（AND）
                        $array = explode('&', $field);
                        foreach ($array as $k) {
                            $filter['$and'][] = $this->parseWhereItem($k, $value);
                        }
                    } else {
                        // 对字段使用表达式查询
                        $field = is_string($field) ? $field : '';
                        $filter[$logic][] = $this->parseWhereItem($field, $value);
                    }
                }
            }
        }
        return $filter;
    }
1024171
public function findOne($query = [], $fields = [])
    {
        if (is_string($query)) {
            return $this->collection->findOne($query, $fields = []);
        }

        return parent::findOne($query, $fields);
    }
1284054
public function orWhereRaw($field, $operator = null, $value = null)
    {
        return $this->where($field, $operator, $value, 'or', true);
    }