I have a node.js server that calls a function that needs to query a Mongodb database.
exports.zonetotal = function(db) {
return function(req, res) {
var inZone1 = 2;
inZone1 = db.collection('driveby').count();
var items = [
{"zone":"1" , "number":inZone1}
];
{
res.json(items);
}
}
};
When I try to use this function and display the results in a table on a webpage i just get a result that says object object. If I just say var inZone1 = 2; then the number displays so I do not think that it is an issue with the way I am trying to send the data, I think that it is an issue with the query. Any ideas, thanks.