Using monogo's shell,
db.collection.find( {key:value} )
returns exactly what I want, only I want to make this query from a browser using a URL like localhost:8000/api/profiles?key=value
I'm trying to use Express, Node and Mongoose.
Here is the code I have:
//Get By query route
router.get('/:param', function(req, res){
var param = req.query(param);
getProfilebyQuery(function(err, profiles) {
if(err){
throw err;
}
res.json(profiles)
})
});
//METHODS GO HERE
//These methods are stored as variables and called in the Routes above.
//Get by Query
var getProfilebyQuery = function(param, callback) {
Iprofile.find(param, callback);
};
What you can't see is "Iprofile" requires my mongoose schemas. I can't tell what I'm doing wrong.