yii\mongodb\ActiveRecord::getDb PHP Method

getDb() public static method

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 getDb ( ) : Connection
return Connection the database connection used by this AR class.
    public static function getDb()
    {
        return \Yii::$app->get('mongodb');
    }