Answers for "how to filter data from mongodb date in reactjs"

0

how to filter data from mongodb date in reactjs

ar moment = require ('moment')

 function previous_year_artist(req, res, next) {
        var dateTimeTofilter = moment().subtract(1, 'year');
        var filter = {
            "date_added": {
                $gte: new Date(dateTimeTofilter._d)
            }
        };
        db.collection.find(
            filter
        ).toArray(function(err, result) {
            if (err) return next(err);
            res.send(result);
        });

    }
Posted by: Guest on January-25-2021

Code answers related to "how to filter data from mongodb date in reactjs"

Code answers related to "Javascript"

Browse Popular Code Answers by Language