TruncateModel
Contract for models able to truncate their collection.
A TruncateModel exposes a single TruncateModel::truncate() operation
that empties the underlying collection, removing every document in one pass.
It is the bulk, unconditional counterpart of DeleteAllModel and is
typically far cheaper than deleting documents one by one.
Tags
Table of Contents
Methods
- truncate() : mixed
- Truncates the collection and removes all documents.
Methods
truncate()
Truncates the collection and removes all documents.
public
truncate([array<string|int, mixed> $init = [] ]) : mixed
Parameters
- $init : array<string|int, mixed> = []
-
Operation options, e.g. flags forwarded to the storage engine. An empty array truncates with default settings.
Tags
Return values
mixed —The truncation result, depending on the implementation
(commonly a boolean, a count, or null).