CodeIgniter Forums
please help me, What does the equivalent in mongoDB to return an array which contains the field name? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: please help me, What does the equivalent in mongoDB to return an array which contains the field name? (/showthread.php?tid=48922)



please help me, What does the equivalent in mongoDB to return an array which contains the field name? - El Forum - 02-02-2012

[eluser]zacksyah[/eluser]
mysql function in Codeigniter I Use list_field() to return an array containing the field names. What does the equivalent in mongoDB to return an array which contains he field name? This code below I use the list_field function
Code:
function GetField($execution) {
    $query = $this->db->query($execution);
    if ($query->num_rows() > 0) {
        return $query->list_fields();
    } else {
        return array();
    }
}
My goal is if there is input with complex queries, the field appears dynamically in accordance with the input query like using phpmyadmin in MySQL & rockmongo in mongoDB.
If there is no equivalent query in MongoDB, Is there a trick to solve my problem?
thanks in advance