Giter Site home page Giter Site logo

codeigniter-mongodb's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

codeigniter-mongodb's Issues

Class 'MongoDB\Database' not found

How can i fix this error?

Message: Class 'MongoDB\Database' not found
Filename: /home/xxxx/public_html/aaa/application/libraries/Mongo_db.php

Select Field

### 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];

No suitable servers found (`serverselectiontryonce` set)

`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`

tailable cursor requested on non capped collection

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.