I am trying yii2 with mongo. This is what i did. Could be a get error

I did Install the following

from my project landing dirictory i ran a command composer require yiisoft/yii2-mongodb

then ran php init and enter 0 and yes

then add in environment/dev/protected/common/config/main-local.php

‘components’ => [

‘mongodb’ => [

‘class’ => ‘\yii\mongodb\Connection’,

‘dsn’ => ‘mongodb://admin:admin@localhost:27017/MYDBNAME’,



also same thing i found under in

protected/common/confing/main-local.php which is auto generated.

But still i am getting error. "ReflectionException Class db does not exist"

Can you please help me to solve it out. or guide me what i am do wrongly.

Please do needful

| Yii vesion | 2.0.6

| PHP version | PHP Version 5.5.9-1ubuntu4.14

| Operating system | ubuntu

You are configuring ‘mongodb’ but you are getting an error - class ‘db’ does not exist.

Either configure ‘db’ or use ‘mongodb’.