So i have some variables, that contains strings. I would like to access my mongodb using these strings, but of course it won't work if i just write it down like that:
...some db connection code
var x="name";
...find all data, then loop
..function(err,docs){
docs[i].x;
}
The queastion is, how can i access the X parameters of my collection.
You can use this way :
database.mydata[i][x];