public function exists($db = null)
    {
        if (!empty($this->emulateExecution)) {
            return false;
        }
        $cursor = $this->buildCursor($db);
        foreach ($cursor as $row) {
            return true;
        }
        return false;
    }
public function exists($db = null)
    {
        if (!empty($this->emulateExecution)) {
            return false;
        }
        $cursor = $this->buildCursor($db);
        foreach ($cursor as $row) {
            return true;
        }
        return false;
    }
public function exists ( $ db = null ) { if ( ! empty ( $ this -> emulateExecution ) ) { return false ; } $ cursor = $ this -> buildCursor ( $ db ) ; foreach ( $ cursor as $ row ) { return true ; } return false ; }
Returns a value indicating whether the query result contains any row of data.
@param Connection $db the Mongo connection used to execute the query.
If this parameter is not given, the `mongodb` application component will be used.
@return bool whether the query result contains any row of data.
Returns a value indicating whether the query result contains any row of data .