Auth using NoSQL with M2 (MongoDB) don'...

  • Hi everybody,

    Does anyone try to using auth with mongoDB using M2 yet?

    I'm trying but get error, so please check for me:

    This is my code

            $auth = Auth::nosql('admin','123456');
            if ($auth) {
                //set the session so user stays logged in
                echo 'logged in';
            } else {
                echo 'can\'t login';    

    But this show error:

    Fatal error: Call to a member function listCollections() on a non-object

    0 /Users/xxxxx/Dev/www/bookmator/lib/m2.php:92

    Please help,

    Best regards,

  • Bong Cosca
    Bong Cosca

    Is the mongodb extension enabled in php.ini?

  • Hi bcosca,

    I've enabled in php.ini, and successful in using F3 to Crud with MongoDB, i
    just have problem with Auth::nosql,
    Could you please show me some working sample code usingAuth::nosql?

    Best regards,