I am using bcit-ci Codeigniter's library for MongoDb, the codeigniter version 3.1 and MongoDb 3.2, having problem in retrieving only one index of array. The where_in is returning the whole array containing object(s). Here's the data structure : Data Structure
I want to get only one object according to the id match. below is the query i written :
$this->mongo_db->select(['email_templates']);
$this->mongo_db->where('_id', new MongoId($vendor_id));
$this->mongo_db->where_in('email_templates.id', [$id]);
$query = $this->mongo_db->get('vendor');
this query is giving the whole array of object(s). I just want the single object which exactly matches the condition.