Join the Stack Overflow Community
Stack Overflow is a community of 6.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I have this document in the 'families' table:

{
        "_id" : {
            "$oid" : "51b701a81c1d7bd459000001"
        },
        "items" : {
            "tasks" : [{
                    "due_date" : "07/06/13",
                    "assignees" : "[email protected]",
                    "_id" : {
                        "$oid" : "51ba0c181c1d7b7c0e00000c"
                    },
                    "type" : "task",
                    "author" : "[email protected]",
                    "creation_date" : "13/06/2013",
                    "name" : "Task0"
                }
            ]
        }
}

Using Codeigniter's ActiveRecord Library I'm trying to access an element in the 'tasks' array by doing so ( '$item_id' is the id of the task I'm looking for):

    $this->mongo_db->where(array('_id' => $this->session->userdata('family_id')))
        ->where(array('items.$.$._id' => $item_id));

    $query = $this->mongo_db->get('families');

So I tried to use the dot notation and the positional operator. But all I get is an empty array.

Please, help, anyone?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.