Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

mongodb node findone how to handle no results using promises

const findUser = async function (params) { 
    try {  return await User.findOne(params)
    } catch(err) { console.log(err) }
}

const userSteve = findUser({firstName: Steve})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mongodb #node #findone #handle #results #promises
ADD COMMENT
Topic
Name
2+5 =