need some help with node js and mongodb how can I return the resp? cause now it returns "undefined";
function(table, where, to_select) {
var r = {};
MongoClient.connect("mongodb://127.0.0.1:27017/db", function(err, db) {
if(!err) {
collection = db.collection(table);
collection.find(where, to_select).toArray(function(err, resp) {
r.t = resp; // return THIS
});
}
});
return r.t; //returns undefined //
}