shankar msr February 2016

How to start work MongoDB with php kohana framework

I'm currently developing the application using php Kohana framework using MongoDB. I've got this link for MongoDB module suitable for this framework. As per instructions given I've configured the module with application. But I'm sticking here not able to proceed further development work. MongoDB based queries are not able use with this module. Following the code getting error to me while selecting single document from the collection.

 <?php defined('SYSPATH') OR die('No Direct Script Access');
    Class Model_Cms extends Model
    {
        public function __construct()
        {
            $this->mongo_db = MangoDB::instance('default');
        }

        /*Get the CMS Content*/
        public function getcmscontent($content,$default_companyid="")
        {
          $cms_result = $this->mongo_db->findOne('cms');
            return $cms_result;
        }
    }

enter image description here

Can anyone help to me proceed further.

Answers


shankar msr February 2016

$cms_result = $this->mongo_db->find_one(MDB_CMS,array('type'=>1,'status'=>1,'menulinks.menu_link'=>$content),array('content','meta_keyword','meta_title','meta_description','menu'));

I've used this method its works for me after several hours spent on this issue.

Post Status

Asked in February 2016
Viewed 2,597 times
Voted 7
Answered 1 times

Search




Leave an answer