I am using node.js and mongodb for geolocation app and req Param returns an empty array
exports.findpressure = function(req, res) {
var queryObject = req.param('q');
console.log(queryObject);
db.collection('Pressure', function(err, collection) {
collection.find( { loc: { $near :[ req.param('q') ] , $maxDistance : 5 }},{"value" : 1, _id : 0}) .sort({_id : -1}).limit(1).toArray(function(err, items)
{
res.send(items);
});
});
};
the longitude and latitude values are displayed in console
Listening on port 3000...
Connected to 'weather' database
8.9068256,52.019347499999995
GET /pressure?q=8.9068256,52.019347499999995 200 27ms - 2b
the url is as follows
http://localhost:3000/pressure?q=8.9068256,52.019347499999995
if i use the values like 8.9068256,52.019347499999995 its getting the value from the database but if i use req.param('q') its returning an empty array