MongoGridFSCursor
class MongoGridFSCursor extends MongoCursor implements Traversable, Iterator (View source)
Properties
static bool | $slaveOkay | ||
static int | $timeout | from MongoCursor | |
protected MongoGridFS|null | $gridfs |
Methods
Create a new cursor
(PECL mongo >= 1.2.11)
Sets whether this cursor will wait for a while for a tailable cursor to return more data
Return the next file to which this cursor points, and advance the cursor
(PECL mongo >= 1.3.3)
Sets whether this query can be done on a slave This method will override the static class variable slaveOkay.
Sets whether this cursor will be left open after fetching the last results
Sets whether this cursor will timeout
Checks if there are documents that have not been sent yet from the database for this cursor
Adds a top-level key/value pair to a query
Returns the current file
Returns the current result's filename
Return an explanation of the query, often useful for optimization and debugging
PECL mongo >= 1.0.11 Limits the number of elements returned in one batch.
(PECL mongo >= 1.5.0) Sets a server-side timeout for this query
Details
__construct(MongoGridFS $gridfs, MongoClient $connection, string $ns, array $query, array $fields)
Create a new cursor
MongoCursor
awaitData(bool $wait = true)
(PECL mongo >= 1.2.11)
Sets whether this cursor will wait for a while for a tailable cursor to return more data
bool
hasNext()
Checks if there are any more elements in this cursor
array
getNext()
Return the next file to which this cursor points, and advance the cursor
array
getReadPreference()
(PECL mongo >= 1.3.3)
MongoCursor
limit(int $num)
Limits the number of results returned
MongoCursor
partial(bool $okay = true)
(PECL mongo >= 1.2.0)
MongoCursor
setFlag(int $flag, bool $set = true)
(PECL mongo >= 1.2.1)
MongoCursor
setReadPreference(string $read_preference, array $tags)
(PECL mongo >= 1.3.3)
MongoCursor
skip(int $num)
Skips a number of results
MongoCursor
slaveOkay(bool $okay = true)
Sets whether this query can be done on a slave This method will override the static class variable slaveOkay.
MongoCursor
tailable(bool $tail = true)
Sets whether this cursor will be left open after fetching the last results
MongoCursor
immortal(bool $liveForever = true)
Sets whether this cursor will timeout
MongoCursor
timeout(int $ms)
Sets a client-side timeout for this query
bool
dead()
Checks if there are documents that have not been sent yet from the database for this cursor
MongoCursor
snapshot()
Use snapshot mode for the query
MongoCursor
sort(array $fields)
Sorts the results by given fields
MongoCursor
hint(mixed $key_pattern)
Gives the database a hint about the query
MongoCursor
addOption(string $key, mixed $value)
Adds a top-level key/value pair to a query
protected void
doQuery()
Execute the query
mixed
current()
Returns the current file
mixed
key()
Returns the current result's filename
void
next()
Advances the cursor to the next result
void
rewind()
Returns the cursor to the beginning of the result set
bool
valid()
Checks if the cursor is reading a valid result.
void
reset()
Clears the cursor
array
explain()
Return an explanation of the query, often useful for optimization and debugging
int
count(bool $all = false)
Counts the number of results for this query
MongoCursor
fields(array $f)
Sets the fields for a query
array
info()
Gets the query, fields, limit, and skip for this cursor
MongoCursor
batchSize(int $batchSize)
PECL mongo >= 1.0.11 Limits the number of elements returned in one batch.
A cursor typically fetches a batch of result objects and store them locally. This method sets the batchSize value to configure the amount of documents retrieved from the server in one data packet. However, it will never return more documents than fit in the max batch size limit (usually 4MB).
MongoCursor
maxTimeMS(int $ms)
(PECL mongo >= 1.5.0) Sets a server-side timeout for this query