public bool MongoWriteBatch::add    ( array $item   )

MongoWriteBatch::addAdds a write operation to a batch

item

An array that describes a write operation. The structure of this value depends on the batch's operation type.
Batch type Argument expectation
MongoWriteBatch::COMMAND_INSERT The document to add.
MongoWriteBatch::COMMAND_UPDATE

Raw update operation.

Required keys are "q" and "u", which correspond to the $criteria and $new_object parameters of MongoCollection::update(), respectively.

Optional keys are "multi" and "upsert", which correspond to the "multiple" and "upsert" options for MongoCollection::update(), respectively. If unspecified, both options default to FALSE.

MongoWriteBatch::COMMAND_DELETE

Raw delete operation.

Required keys are: "q" and "limit", which correspond to the $criteria parameter and "justOne" option of MongoCollection::remove(), respectively.

The "limit" option is an integer; however, MongoDB only supports 0 (i.e. remove all matching documents) and 1 (i.e. remove at most one matching document) at this time.