|
@@ -19,7 +19,6 @@ module.exports = {
|
|
|
async connect(mongoConnectionString) {
|
|
|
const connection = await mongoose.connect(mongoConnectionString, { useNewUrlParser: true, useFindAndModify: false })
|
|
|
mongoose.connection.on('error', err => console.log(err))
|
|
|
- console.log('The database connection was established.')
|
|
|
return connection
|
|
|
},
|
|
|
|
|
@@ -28,9 +27,8 @@ module.exports = {
|
|
|
* @param {Object} connectionObj Connecion object
|
|
|
* @returns {Promise<void>} The connection was destroyed
|
|
|
*/
|
|
|
- async disconnect(connectionObj) {
|
|
|
- await connectionObj.disconnect()
|
|
|
- console.log('The database connection was destroyed.')
|
|
|
+ disconnect(connectionObj) {
|
|
|
+ return connectionObj.disconnect()
|
|
|
},
|
|
|
|
|
|
|
|
@@ -43,7 +41,7 @@ module.exports = {
|
|
|
*/
|
|
|
async add(dataObj) {
|
|
|
const doc = await DataModel.create({ data: dataObj })
|
|
|
- console.log(`New document was added. id=${doc.id}`)
|
|
|
+ // console.log(`New document was added. id=${doc.id}`)
|
|
|
return doc
|
|
|
},
|
|
|
|
|
@@ -54,7 +52,7 @@ module.exports = {
|
|
|
*/
|
|
|
async del(dataId) {
|
|
|
const doc = await DataModel.findByIdAndDelete(dataId)
|
|
|
- console.log(`A document was deleted. id=${doc.id}`)
|
|
|
+ // console.log(`A document was deleted. id=${doc.id}`)
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -65,7 +63,7 @@ module.exports = {
|
|
|
*/
|
|
|
async update(dataId, newDataObj) {
|
|
|
const doc = await DataModel.findByIdAndUpdate(dataId, { $set: { data: newDataObj } }, { new: true })
|
|
|
- console.log(`A document was updated. id=${doc.id}`)
|
|
|
+ // console.log(`A document was updated. id=${doc.id}`)
|
|
|
return doc
|
|
|
},
|
|
|
|