CodeIgniter Forums
new codeigniter mongoDB library - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: new codeigniter mongoDB library (/showthread.php?tid=49434)



new codeigniter mongoDB library - El Forum - 02-19-2012

[eluser]vesparny[/eluser]
I've just pushed on github the first release of my codeigniter library for interact with mongoDB.

let me know Smile

https://github.com/vesparny/cimongo-codeigniter-mongodb-library


new codeigniter mongoDB library - El Forum - 02-21-2012

[eluser]vesparny[/eluser]
stable version is tagged on github:
https://github.com/vesparny/cimongo-codeigniter-mongodb-library/tags


new codeigniter mongoDB library - El Forum - 04-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

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.


new codeigniter mongoDB library - El Forum - 04-03-2012

[eluser]vesparny[/eluser]
Hi zacksyah, the php mongoDb driver doesn't allow that, there is no list_fields() method.
Maybe because in mongo you can have subobjects...

you can use array_keys
http://php.net/manual/en/function.array-keys.php.

If you want you can send me a pull req on github...
let me know Smile


new codeigniter mongoDB library - El Forum - 04-03-2012

[eluser]zacksyah[/eluser]
The example of the method I gave above is not to MongoDB but for SQL. I mean, I want to create a simple application query executor like phpmyadmin(Just for create, update, deletr, read & searching data). Well the problem is how do I display the columns dynamically in accordance with the instructions given?
please help me.


new codeigniter mongoDB library - El Forum - 04-04-2012

[eluser]vesparny[/eluser]
a query with cimongo lib returns an object or array.
For example the array is a key=>value array.
key is your column name, value is the actual value for that row.
you can simply get every key on the first row and you have the column name.


new codeigniter mongoDB library - El Forum - 04-05-2012

[eluser]zacksyah[/eluser]
so with your library, can I display the columns dynamically? Example the Query like this " db.users.find({'last_name': 'Smith'})"
the column that will appear is Last_name.


new codeigniter mongoDB library - El Forum - 04-05-2012

[eluser]vesparny[/eluser]
yes, you can get the column name with no problems


new codeigniter mongoDB library - El Forum - 04-08-2012

[eluser]zacksyah[/eluser]
this is my sql executor that I mean
https://[email protected]/zacksyah/sql_executor.git
you can check the function GetField at model file, there is a list_field() function that I must change with mongoDB library in codeigniter. But I dont know how. Can you help me for mongoDB executor. thanks in advance


new codeigniter mongoDB library - El Forum - 04-29-2012

[eluser]zacksyah[/eluser]
anyone can help my problem above