Skip to content

Instantly share code, notes, and snippets.

@harryWonder
Created June 4, 2020 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harryWonder/f20aaa4170b2af1a3b15b9f47469800b to your computer and use it in GitHub Desktop.
Save harryWonder/f20aaa4170b2af1a3b15b9f47469800b to your computer and use it in GitHub Desktop.
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