mongodb\ActiveRecord updateAll()

updateAll() public static method

Updates all documents in the collection using the provided attribute values and conditions.

For example, to change the status to be 1 for all customers whose status is 2:

Customer::updateAll(['status' => 1], ['status' => 2]);
public static integer updateAll ( $attributes, $condition = [], $options = [] )
$attributes array

Attribute values (name-value pairs) to be saved into the collection

$condition array

Description of the objects to update. Please refer to yii\mongodb\Query::where() on how to specify this parameter.

$options array

List of options in format: optionName => optionValue.

return integer

The number of documents updated.

doc_Yii
2016-10-30 17:07:28
Comments
Leave a Comment

Please login to continue.