-2
Hello, I am developing an application in Node.js and I am having difficulty.
In case my findOneUpdate doesn’t find anything I wanted a create to be done, but I couldn’t find a way to create an if or something.
follows the code:
Exports.getAndUpdateByNome = async (date) => { await staticAnalise . findOneAndUpdate(date.name, { $set: { name: date.name, date: date.date } }); }
Welcome to Sopt. With so little information it is impossible to suggest anything. Try to be clearer in your question and add more information, such as the database that is used.
– tvdias