Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The checkNote method from the Notes.js file
async checkNote(title) {
const dbConnection = await this.createConnection();
return dbConnection.collection('notes_db').findOne({ title }).then((doc) => {
if (doc) {
return true;
} else {
return false;
}
}).catch((e) => {
console.log('*********** Error ***********');
console.log(`ErrorName: ${e.name}`);
console.log(`errorMessage: ${e.message}`);
console.log('*********** Error ***********');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment