-1

I have stored lots of users names in MongoDB and now I want to fetch those data whose lastname='das' and showing them in display
So how can I do that?

  • 1
    Does this answer your question? [How I can use "LIKE" operator on mongoose?](https://stackoverflow.com/questions/43729199/how-i-can-use-like-operator-on-mongoose) – Aswath Jul 01 '21 at 04:17

1 Answers1

0
router.route('/find').get(function(req,res){

restuarant.find( {"dish": /fish/},function(err, result){

 if(err){
      res.send(err)
 }
 else{
      res.json(result)
 }

})

This route handler will filter all those documents in which the dish field contains “fish” in it. It does not matter if the “fish” comes in front, or middle, or at the last.

Divyesh
  • 2,085
  • 20
  • 35