codeigniter-mongodb-library icon indicating copy to clipboard operation
codeigniter-mongodb-library copied to clipboard

How to use distinct query using this library? I want to fetch distinct values of fields from collection.

Open vidhisampat2807 opened this issue 6 years ago • 1 comments

How to use distinct query using this library? I want to fetch distinct values of fields from collection. There is a function for distinct in library. I have used function from controller by below code.

$logs = $this->mongo_db->distinct('logs', 'log_section');
echo "<pre>";print_r($logs);exit;

Here logs is collection name and log_section is field name but i am getting below error

A PHP Error was encountered
Severity: Notice
Message:  Undefined property: MongoDB\Driver\Manager::$logs

Filename: libraries/Mongo_db.php
Line Number: 1337
	
Backtrace:		
			File: /var/www/html/nkninst/master/application/libraries/Mongo_db.php
			Line: 1337
			Function: _error_handler						

			File: /var/www/html/nkninst/master/application/controllers/Migration.php
			Line: 48
			Function: distinct						

			File: /var/www/html/nkninst/master/index.php
			Line: 315
			Function: require_once	

vidhisampat2807 avatar Aug 06 '19 06:08 vidhisampat2807

@vidhisampat2807 do you found the way to implement this function?

perla-colon avatar Sep 17 '20 17:09 perla-colon