mongodb - PHP + MongoHQ : MongoCursorException -


I am trying to use mongodb with PHP, I have created a MongoHQ example, but for some reasons From when I try to insert some or some other operation from my PHP server, I get the following error:

  Fatal error: Unauthorized exception with 'MongoCursorException' message 'unauthorized DB [database] lock type: -1 'in C: \ program files \ EasyPHP5.3.0 \ www \ application \ rule Controller \ Stat.ctrl.php: 56 Stack Trace: # 0C: \ Program Files \ EasyPHP5.3.0 \ www \ Application Controller \ Stat.ctrl.php (56): Mongoccus-> Rewind () # 1C: \ Program Files \ EasyPHP5.3.0 \ www \ index.php (105): State - & gt; Index () # 2 {main} Throwed in C: \ Program Files \ EasyPHP5.3.0 \ www \ Application \ Controller \ Stat.ctrl.php on line 56  

Anyone Do you know where it is coming from?

This is the php code I am using:

  $ username = 'test'; $ Password = 'test'; {$ Link = New Mongo ("flame.mongohq.com thousand7022 / datab -u & lt;" Username. "& Gt; -p & lt;". $. Password. "& Gt;"); // Mongodi :: Certify ($ username, $ password) // $ link = new Mongo (); } Catch (Mongo Connection Aspen $ E) {Dead ('Could not connect. Make sure that mongodibi is going.'); } $ Db = $ link- & gt; Database; $ Col = $ db- & gt; order; Try (//) $ doc = array in the collection (table) = 'Login' => Jismith, 'Password' = 5; '); $ Col- & gt; Insert ($ doc, true); $ Doc = Array ('Login' =>> psmith ',' password '= & gt;' 5f4dcc3b ',' email '=>' psmith@example.com '); $ Col- & gt; Insert ($ doc, true); } Catch (Monsquarar exposition $ E) {echo 'jay suis la!'; } // Enter the last id $ id = $ doc ['_ id']; // Get all documents $ res = $ col- & gt; Search (); 'Echo all documents: & lt; Br / & gt; '; Foreign currency ($ res $ doc) {echo '& lt; Pre & gt; '; Print_r ($ dock); Echo & lt; / Pre & gt; '; } // Last entry id $ doc = $ col- & gt; Question for the document matched with searchon (array ('_ id' = & gt; $ id)); Echo single document (_id = $ id): & lt; Br / & gt; & Lt; Pre & gt; '; Print_r ($ dock); // a document $ col- & gt; Update (Arrays ('_ id' = & gt; $ id), array ('$ set' = & gt; array ('password' = & gt; 'B 497D1A701A 33033620780D')) ); // $ doc = $ col- & gt; Searches (query ('_ id' = & gt; $ id) query the updated document); Echo 'updated document: & lt; Br / & gt; & Lt; Pre & gt; '; Print_r ($ dock); Echo & lt; / Pre & gt; ';  

See this connection format does not use MongoDB

You need to change this:

  $ m = new Mongo ("mongodb: // $ username: $password@flame.mongohq com: 27,022 / datab" );  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -