Skip to content

Instantly share code, notes, and snippets.

@harryWonder
Created June 4, 2020 08:57
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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