Documentation

EstimatedDocumentCount
in package
implements Executable, Explainable

Operation for obtaining an estimated count of documents in a collection

Tags
see
Collection::estimatedDocumentCount()
see
http://docs.mongodb.org/manual/reference/command/count/

Interfaces, Classes, Traits and Enums

Executable
Explainable

Table of Contents

$collectionName  : string
$databaseName  : string
$errorCodeCollectionNotFound  : int
$options  : array<string|int, mixed>
$wireVersionForCollStats  : int
__construct()  : mixed
Constructs a command to get the estimated number of documents in a collection.
execute()  : int
Execute the operation.
getCommandDocument()  : array<string|int, mixed>
Returns the command document for this operation.
createAggregate()  : Aggregate
createCommand()  : Aggregate|Count
createCount()  : Count

Properties

Methods

__construct()

Constructs a command to get the estimated number of documents in a collection.

public __construct(string $databaseName, string $collectionName[, array<string|int, mixed> $options = [] ]) : mixed

Supported options:

  • maxTimeMS (integer): The maximum amount of time to allow the query to run.

  • readConcern (MongoDB\Driver\ReadConcern): Read concern.

  • readPreference (MongoDB\Driver\ReadPreference): Read preference.

  • session (MongoDB\Driver\Session): Client session.

Parameters
$databaseName : string

Database name

$collectionName : string

Collection name

$options : array<string|int, mixed> = []

Command options

Tags
throws
InvalidArgumentException

for parameter/option parsing errors

Return values
mixed

execute()

Execute the operation.

public execute(Server $server) : int
Parameters
$server : Server
Tags
see
Executable::execute()
throws
UnexpectedValueException

if the command response was malformed

throws
UnsupportedException

if collation or read concern is used and unsupported

throws
RuntimeException

for other driver errors (e.g. connection errors)

Return values
int

getCommandDocument()

Returns the command document for this operation.

public getCommandDocument(Server $server) : array<string|int, mixed>
Parameters
$server : Server
Tags
see
Explainable::getCommandDocument()
Return values
array<string|int, mixed>

Search results