Skip to content

Latest commit

 

History

History
143 lines (63 loc) · 2.15 KB

DeleteOne.md

File metadata and controls

143 lines (63 loc) · 2.15 KB

DeleteOne

Operation for deleting a single document with the delete command.

See Also:

Properties

delete

private \MongoDB\Operation\Delete $delete

Methods

__construct

Constructs a delete command.

public __construct(string $databaseName, string $collectionName, array|object $filter, array $options = []): mixed

Supported options:

  • collation (document): Collation specification.

  • hint (string|document): The index to use. Specify either the index name as a string or the index key pattern as a document. If specified, then the query system will only consider plans using the hinted index.

    This is not supported for server versions < 4.4 and will result in an exception at execution time if used.

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

  • writeConcern (MongoDB\Driver\WriteConcern): Write concern.

Parameters:

Parameter Type Description
$databaseName string Database name
$collectionName string Collection name
$filter array|object Query by which to delete documents
$options array Command options

execute

Execute the operation.

public execute(\MongoDB\Driver\Server $server): \MongoDB\DeleteResult

Parameters:

Parameter Type Description
$server \MongoDB\Driver\Server

See Also:

  • \MongoDB\Operation\Executable::execute() -

getCommandDocument

Returns the command document for this operation.

public getCommandDocument(\MongoDB\Driver\Server $server): array

Parameters:

Parameter Type Description
$server \MongoDB\Driver\Server

See Also:

  • \MongoDB\Operation\Explainable::getCommandDocument() -