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

Help
2012-02-07
2012-09-25
  • 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

    $this->set('AUTH',array('db'=>'bokmater','collection'=>'users','id'=>'username','pw'=>'password'));
            $auth = Auth::nosql('admin','123456');
            if ($auth) {
                //set the session so user stays logged in
                $this->set('SESSION.user',$auth->name);
                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
    2012-02-07

    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,