EstimatedDocumentCount
in package
implements
Executable, Explainable
Operation for obtaining an estimated count of documents in a collection
Tags
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
$collectionName
private
string
$collectionName
$databaseName
private
string
$databaseName
$errorCodeCollectionNotFound
private
static int
$errorCodeCollectionNotFound
= 26
$options
private
array<string|int, mixed>
$options
$wireVersionForCollStats
private
static int
$wireVersionForCollStats
= 12
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
Return values
mixed —execute()
Execute the operation.
public
execute(Server $server) : int
Parameters
- $server : Server
Tags
Return values
int —getCommandDocument()
Returns the command document for this operation.
public
getCommandDocument(Server $server) : array<string|int, mixed>
Parameters
- $server : Server
Tags
Return values
array<string|int, mixed> —createAggregate()
private
createAggregate() : Aggregate
Return values
Aggregate —createCommand()
private
createCommand(Server $server) : Aggregate|Count
Parameters
- $server : Server
Return values
Aggregate|Count —createCount()
private
createCount() : Count