i try to find a way to use vars for mongojs collections. The data are dynamic and also the db.VAR.find(); must be dynamic. Is there a solution for that problem. I searched here and google, but there is nothing. I hope you can help me.
Example:
var var1 = "game12"; var var2 = "game34";
db.***var1***.find({name: x},function(err, datas) {
if( err || !datas ) {
console.log("Problem finding data :" + err);
}else{
datas.forEach( function(curData) {
console.log(curData);
});
} });
db.***var2***.find({name: x},function(err, datas) {
if( err || !datas ) {
console.log("Problem finding data :" + err);
}else{
datas.forEach( function(curData) {
console.log(curData);
});
} });