How to perform a filter using Mongoose?

0

I already know how to implement a filter using the MongoDB identifier key, however I'm trying to implement a value attribute filter, and I'm not getting it, see below;

What I need is that when typing the value the slug and already bring the record for that value, but different from that is returning me Array empty.

Thesearetherecordsthatareinmybank

Where is the problem?

This is my controller;

exports.getSlug = (req, res, next) => {
    Restaurant
    .find({
        slug: req.params.slug
    }, 'name category deliveryEstimate rating')
    .then(data => {
        res.status(200).send(data);
    }).catch(e => {
        res.status(401).send(e);   
    })

};

My route is like this;

router.get('/restaurant/:sluf', constroller.getSlug);

Please, where is it wrong?

    
asked by anonymous 06.07.2018 / 16:25

0 answers