mongodb\ActiveRecord deleteAll()

deleteAll() public static method Deletes documents in the collection using the provided conditions. WARNING: If you do not specify any condition, this method will delete documents rows in the collection. For example, to delete all customers whose status is 3: Customer::deleteAll(['status' => 3]); public static integer deleteAll ( $condition = [], $options = [] )$condition array Description of the objects to delete. Please refer to yii\mongodb\Query::where() on how to specify this par

mongodb\ActiveRecord delete()

delete() public method Deletes the document corresponding to this active record from the collection. This method performs the following steps in order: call beforeDelete(). If the method returns false, it will skip the rest of the steps; delete the document from the collection; call afterDelete(). In the above step 1 and 3, events named EVENT_BEFORE_DELETE and EVENT_AFTER_DELETE will be raised by the corresponding methods. public integer|boolean delete ( )return integer|boolean The num

mongodb\ActiveRecord collectionName()

collectionName() public static method Declares the name of the Mongo collection associated with this AR class. Collection name can be either a string or array: if string considered as the name of the collection inside the default database. if array - first element considered as the name of the database, second - as name of collection inside that database By default this method returns the class name as the collection name by calling yii\helpers\Inflector::camel2id(). For example, 'Customer'

mongodb\ActiveRecord attributes()

attributes() public method Returns the list of all attribute names of the model. This method must be overridden by child classes to define available attributes. Note: primary key attribute "_id" should be always present in returned array. For example: public function attributes() { return ['_id', 'name', 'address', 'status']; } public array attributes ( )return array List of attribute names. throws yii\base\InvalidConfigException if not implemented

mongodb\ActiveQuery __construct()

__construct() public method Constructor. public void __construct ( $modelClass, $config = [] )$modelClass array The model class associated with this query $config array Configurations to be applied to the newly created query object

mongodb\ActiveQuery populate()

populate() public method Converts the raw query results into the format as specified by this query. This method is internally used to convert the data fetched from MongoDB into the format as required by this query. public array populate ( $rows )$rows array The raw query result from MongoDB return array The converted query result

mongodb\ActiveQuery one()

one() public method Executes query and returns a single row of result. public yii\mongodb\ActiveRecord|array|null one ( $db = null )$db yii\mongodb\Connection The Mongo connection used to execute the query. If null, the Mongo connection returned by $modelClass will be used. return yii\mongodb\ActiveRecord|array|null A single row of query result. Depending on the setting of asArray(), the query result may be either an array or an ActiveRecord object. Null will be returned if the query

mongodb\ActiveQuery modify()

modify() public method Performs 'findAndModify' query and returns a single row of result. Warning: in case 'new' option is set to 'false' (which is by default) usage of this method may lead to unexpected behavior at some Active Record features, because object will be populated by outdated data. public yii\mongodb\ActiveRecord|array|null modify ( $update, $options = [], $db = null )$update array Update criteria $options array List of options in format: optionName => optionValue. $db

mongodb\ActiveQuery init()

init() public method Initializes the object. This method is called at the end of the constructor. The default implementation will trigger an EVENT_INIT event. If you override this method, make sure you call the parent implementation at the end to ensure triggering of the event. public void init ( )

mongodb\ActiveQuery getCollection()

getCollection() public method Returns the Mongo collection for this query. public yii\mongodb\Collection getCollection ( $db = null )$db yii\mongodb\Connection Mongo connection. return yii\mongodb\Collection Collection instance.