diff --git a/src/js/mongoClient.js b/src/js/mongoClient.js index 084e29f..df3ec58 100644 --- a/src/js/mongoClient.js +++ b/src/js/mongoClient.js @@ -14,12 +14,6 @@ class MongoClient { assert.equal(null, err); console.log('Connected successfuly to mongodb'); this.db = client.db(mongoConfig.database); - - this.db.collection('test').find({}, (err, results) => { - results.forEach(console.log); - }); - - // client.close(); }); } @@ -37,7 +31,8 @@ class MongoClient { this.db.collection(collectionName).insert(entity, (error, result) => { assert.equal(null, error, `Unable to insert ${collectionName} entity: ${error}.`); console.log(`Entity ${collectionName} inserted.`); - callback(result); + // Return only the inserted document. + callback(result.ops[0]); }); }