Question: The code below works, it updates a record or creates one if it doesn't exist yet. However, I'd like to combine this `findOneAndUpdate()` statement with the `populate()` method in order to populate the "user" of my object. What would be the right way to add the `populate("user")` statement to this logic?

I tried adding the `populate()` method after the `findOneAndUpdate` finishes but that returns an error saying that this method doesn't exist. I'm running the latest version of mongoose.

```
LoyaltyCard.findOneAndUpdate({ business: businessid}, { $set: newCard, $inc: { stamps: +1 } }, { upsert: true}, function(err, card){

    if(err)
    {

    }
    else
    {

    }

    res.json(result);
});

```

Answer: 
With `async/await` I removed the exec

```
const getLoyaltyCard = async () => {
    const results = await LoyaltyCard.findOneAndUpdate(
        { business: businessid },
        { $set: newCard, $inc: { stamps: + 1 } },
        { upsert: true }
    )
    .populate('user')
    return results
}

```
Just enhancing @rahulchouhan's answer:

You can add the populate as one of the options which is the third parameter of findOneAndUpdate function and it works just like any other promise (then, catch)

```
LoyaltyCard.findOneAndUpdate(
        { business: businessid },
        { $set: newCard, $inc: { stamps: +1 } },
        { upsert: true, populate: { path: 'user' } }
    )
    .then(card => {
       res.status(200).json(card);
    }).catch(err => {
       res.status(500).json({ message: err.message});
    });

```