Created
June 4, 2020 08:57
-
-
Save harryWonder/f20aaa4170b2af1a3b15b9f47469800b to your computer and use it in GitHub Desktop.
The checkNote method from the Notes.js file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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