Fresh Install mongodb not working (reproduceable)

I am having trouble doing what seems like a simple thing:

Ampps, php 7, default latest yii advanced app installed via composer, init in dev mode, latest mongo extension installed via composer,

changed common/models/User to use




public static function collectionName() {

        return "user";

    }



Instead of Table name,

added attributes in common\models\User (required by mongo):




     public function attributes() {

        return [

            '_id',

            'username',

            'email',

            'status',

            'password_hash',

            'auth_key',

            'created_at',

            'updated_at'

        ];

    }



Successfully signed up using default signup form and verified that the user is in the database, however it does not log me in, the yii\web\User::login() seems to be the issue however it’s not throwing errors, it simply doesnt set my identity properly.

Logging in using the default login form appears to work, it validates properly and won’t get past validation unless the username and password are correct. However, it doesn’t show me logged in when it redirects to the home page (i never see a logout(username) button).

Can someone please attempt these steps, I am simply trying to get yii2 with mongodb to log me in while changing as little code as possible.

Thanks,

Odu

I fixed the issue:




    /**

     * @inheritdoc

     */

    public static function findIdentity($id)

    {

        return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]);

    }



should read:




    /**

     * @inheritdoc

     */

    public static function findIdentity($id)

    {

        return static::findOne(['_id' => $id, 'status' => self::STATUS_ACTIVE]);

    }