Think/Db/Driver/Mongo.php
protected function parseThinkWhere($key, $val)
    {
        $query = [];
        $_logic = ['or', 'xor', 'nor', 'and'];

        switch ($key) {
            case '_query':
                // 字符串模式查询条件
                parse_str($val, $query);
                if (isset($query['_logic']) && strtolower($query['_logic']) == 'or') {
                    unset($query['_logic']);
                    $query['$or'] = $query;
                }
                break;
            case '_complex':
                // 子查询模式查询条件
                $__logic = strtolower($val['_logic']);
                if (isset($val['_logic']) && in_array($__logic, $_logic)) {
                    unset($val['_logic']);
                    $query['$'.$__logic] = $val;
                }
                break;
            case '_string':
                // MongoCode查询
                $query['$where'] = new \MongoCode($val);
                break;
        }
        //兼容 MongoClient OR条件查询方法
        if (isset($query['$or']) && !is_array(current($query['$or']))) {
            $val = [];
            foreach ($query['$or'] as $k => $v) {
                $val[] = [$k => $v];
            }
            $query['$or'] = $val;
        }

        return $query;
    }
protected function parseThinkWhere($key, $val)
    {
        $query = [];
        $_logic = ['or', 'xor', 'nor', 'and'];

        switch ($key) {
            case '_query':
                // 字符串模式查询条件
                parse_str($val, $query);
                if (isset($query['_logic']) && strtolower($query['_logic']) == 'or') {
                    unset($query['_logic']);
                    $query['$or'] = $query;
                }
                break;
            case '_complex':
                // 子查询模式查询条件
                $__logic = strtolower($val['_logic']);
                if (isset($val['_logic']) && in_array($__logic, $_logic)) {
                    unset($val['_logic']);
                    $query['$'.$__logic] = $val;
                }
                break;
            case '_string':
                // MongoCode查询
                $query['$where'] = new \MongoCode($val);
                break;
        }
        //兼容 MongoClient OR条件查询方法
        if (isset($query['$or']) && !is_array(current($query['$or']))) {
            $val = [];
            foreach ($query['$or'] as $k => $v) {
                $val[] = [$k => $v];
            }
            $query['$or'] = $val;
        }

        return $query;
    }
特殊条件分析
@param string $key
@param mixed $val
@return string