Wednesday, 31 May 2017

Save Or Update Mongoose

Is there a nice way of either saving, or updating a document in mongoose? Something like what I'm after below

 let campaign = new Campaign({
        title: req.body.title,
        market: req.body.market,
        logo: req.body.logo,
        additional_question_information: question,
        status: status
    });

 campaign.saveOrUpdate().then(function() { ... }

Thanks for the help all



via Ollie

No comments:

Post a Comment