The MongoDB\Driver\WriteResult class
(mongodb >=1.0.0)
Introduction
The MongoDB\Driver\WriteResult class encapsulates information about an executed MongoDB\Driver\BulkWrite and may be returned by MongoDB\Driver\Manager::executeBulkWrite().
Class synopsis
Properties
insertedCount
The number of documents inserted (excluding upserts), or null if
the write concern did not request acknowledgement.
The number of documents matched by update and replace operations, or
null if the write concern did not request acknowledgement.
The number of documents modified by update and replace operations, or
null if the write concern did not request acknowledgement or if the
server did not report this information.
The number of documents deleted, or null if the write concern did
not request acknowledgement.
The number of documents upserted, or null if the write concern did
not request acknowledgement.
The server that executed the bulk write.
upsertedIds
An array of _id values for upserted documents.
Array keys will correspond to the index of the write operation from
MongoDB\Driver\BulkWrite.
An array of MongoDB\Driver\WriteErrors for any write errors that occurred during execution.
writeConcernError
The MongoDB\Driver\WriteConcernError that
occurred, or null if no write concern error occurred.
The MongoDB\Driver\WriteConcern used for the
bulk write, or null if not available.
An array of error reply documents from the server.
Changelog
| Version | Description |
|---|---|
| PECL mongodb 2.3.0 | Added public readonly properties. |
Table of Contents
- MongoDB\Driver\WriteResult::getDeletedCount — Returns the number of documents deleted
- MongoDB\Driver\WriteResult::getInsertedCount — Returns the number of documents inserted (excluding upserts)
- MongoDB\Driver\WriteResult::getMatchedCount — Returns the number of documents selected for update
- MongoDB\Driver\WriteResult::getModifiedCount — Returns the number of existing documents updated
- MongoDB\Driver\WriteResult::getServer — Returns the server associated with this write result
- MongoDB\Driver\WriteResult::getUpsertedCount — Returns the number of documents inserted by an upsert
- MongoDB\Driver\WriteResult::getUpsertedIds — Returns an array of identifiers for upserted documents
- MongoDB\Driver\WriteResult::getWriteConcernError — Returns any write concern error that occurred
- MongoDB\Driver\WriteResult::getWriteErrors — Returns any write errors that occurred
- MongoDB\Driver\WriteResult::isAcknowledged — Returns whether the write was acknowledged
来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。
