I'm facing some challenges while working with queries in my MEAN App.
Specifically, I am attempting to retrieve data that matches the input entered into a search field:
$scope.searchInput = function(search){
$http({
method: 'GET',
url: '/search',
params: {'licensor.name' : search}
})
.success(
function(success){
console.log(success)
})
.error(
function(error){
console.log(error)
});
}
On the server side, my code is as follows:
app.get('/search', function(req,res){
ImportCollection.find(function(err, imports){
if(err) throw err
res.json(imports)
});
});
However, this always returns the full collection. Any thoughts on how to solve this?