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. Plea

mongodb\ActiveRecord toArray()

toArray() public method Converts the model into an array. This method will first identify which fields to be included in the resulting array by calling resolveFields(). It will then turn the model into an array with these fields. If $recursive is true, any embedded objects will also be converted into arrays. If the model implements the \yii\mongodb\Linkable interface, the resulting array will also have a _link element which refers to a list of links as specified by the interface. public a

mongodb\ActiveRecord primaryKey()

primaryKey() public static method Returns the primary key name(s) for this AR class. The default implementation will return ['_id']. Note that an array should be returned even for a collection with single primary key. public static string[] primaryKey ( )return string[] The primary keys of the associated Mongo collection.

mongodb\ActiveRecord insert()

insert() public method Inserts a row into the associated Mongo collection using the attribute values of this record. This method performs the following steps in order: call beforeValidate() when $runValidation is true. If validation fails, it will skip the rest of the steps; call afterValidate() when $runValidation is true. call beforeSave(). If the method returns false, it will skip the rest of the steps; insert the record into collection. If this fails, it will skip the rest of the steps;

mongodb\ActiveRecord getDb()

getDb() public static method Returns the Mongo connection used by this AR class. By default, the "mongodb" application component is used as the Mongo connection. You may override this method if you want to use a different database connection. public static yii\mongodb\Connection getDb ( )return yii\mongodb\Connection The database connection used by this AR class.

mongodb\ActiveRecord insertInternal()

insertInternal() protected method See also yii\mongodb\ActiveRecord::insert(). protected void insertInternal ( $attributes = null )$attributes

mongodb\ActiveRecord getCollection()

getCollection() public static method Return the Mongo collection instance for this AR class. public static yii\mongodb\Collection getCollection ( )return yii\mongodb\Collection Collection instance.

mongodb\ActiveRecord equals()

equals() public method Returns a value indicating whether the given active record is the same as the current one. The comparison is made by comparing the collection names and the primary key values of the two active records. If one of the records is new they are also considered not equal. public boolean equals ( $record )$record yii\mongodb\ActiveRecord Record to compare to return boolean Whether the two active records refer to the same row in the same Mongo collection.

mongodb\ActiveRecord find()

find() public static method Creates an \yii\mongodb\ActiveQueryInterface instance for query purpose. The returned \yii\mongodb\ActiveQueryInterface instance can be further customized by calling methods defined in \yii\mongodb\ActiveQueryInterface before one() or all() is called to return populated ActiveRecord instances. For example, // find the customer whose ID is 1 $customer = Customer::find()->where(['id' => 1])->one(); // find all active customers and order them by their age:

mongodb\ActiveRecord deleteInternal()

deleteInternal() protected method See also yii\mongodb\ActiveRecord::delete(). protected void deleteInternal ( )throws yii\db\StaleObjectException