ehoutsma / codeigniter-mongodb Goto Github PK
View Code? Open in Web Editor NEWLibrary for connection to MongoDB with PHP7
Library for connection to MongoDB with PHP7
Does it have a populate method?
How can i fix this error?
Message: Class 'MongoDB\Database' not found
Filename: /home/xxxx/public_html/aaa/application/libraries/Mongo_db.php
### Suggestion
Using this library I was not able to get a single field from the MongoDB collection.
I tried to execute a select query ( $this->mongo_db->select(array('foo', 'bar'))->get('foobar'); ). But it returns all the data of the document.
For fixing this issue I went through the library I found an issue in the get method. In the get method, there is $options variable in that array we are passing 'projection'. we just need to remove [] of 'projection'.
or you can replace below mention line in the library.
Current Code ( Mongo_db.php -> get function line no 776 )
$options = ['limit'=>(int) $this->limit, 'skip'=>(int) $this->offset, 'sort'=>$this->sorts, 'batchSize'=>(int)$this->limit, 'cursorType'=>2, ['projection'=>$this->selects]];
Replace to
$options = ['limit'=>(int) $this->limit, 'skip'=>(int) $this->offset, 'sort'=>$this->sorts, 'batchSize'=>(int)$this->limit, 'cursorType'=>2, 'projection'=>$this->selects];
`An uncaught Exception was encountered
Type: MongoDB\Driver\Exception\ConnectionTimeoutException
Message: No suitable servers found (serverselectiontryonce
set)
Filename: /var/www/html/application/vendor/mongodb/mongodb/src/Collection.php
Line Number: 438
Backtrace:
File: /var/www/html/application/vendor/mongodb/mongodb/src/Collection.php
Line: 438
Function: selectServer`
Using this library i am not able to execute simple get, i am getting this error:
error processing query: ns=testdb.mongo_users batchSize=10 limit=10Tree: $and Sort: {} Proj: {} tailable cursor requested on non capped collection
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.