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);
});
} });
db[var1].find(...
db[var2].find(...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With