We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

list all collections in mongodb - Returns nothing

Hi,

The below code return empty. Can you please suggest me how do I access direct mongodb php functions ?

           $db = $this->di->get('mongo');
            $collections = $db->listCollections();
            foreach ($collections as $collection) {
                    print "amount of documents in $collection ". $collection->count();
            }

Thanks, Raja K