MongoCursor::doQuery

(No version information available, might only be in Git)

MongoCursor::doQueryExecute the query.

Description

protected void MongoCursor::doQuery ( void )
Warning

Please do not use me.

This function actually queries the database. All queries and commands go through this function. Thus, this function can be overridden to provide custom query handling.

This handles serializing your query, sending it to the database, receiving a response, and deserializing it. Thus, if you are planning to override this, your code should probably call out to the original to use the existing functionality (see the example below).

Parameters

This function has no parameters.

Return Values

NULL.

Errors/Exceptions

Throws MongoConnectionException if it cannot reach the database.

Changelog

Version Description
1.2.11 Emits E_DEPRECATED when used.

Examples

Example #1 MongoCursor::doQuery() example

You could override this function to attempt a query on a secondary and, if that fails, try it again on the primary.

<?php

class MyCursor extends MongoCursor {

    protected function 
doQuery() {

        
$this->slaveOkay();

        try {
            
MongoCursor::doQuery();
        }
        catch(
MongoCursorException $e) {
            
$this->slaveOkay(false);
            
MongoCursor::doQuery();
        }
    }
}

?>

Коментарии

Автор:
Does not work for MongoDB Native Driver Version 1.1.0 (version may be seen via phpinfo())
2011-09-12 23:27:39
http://php5.kiev.ua/manual/ru/mongocursor.doquery.html

    Поддержать сайт на родительском проекте КГБ