diff --git a/task-manager/mongodb.js b/task-manager/mongodb.js index d304d6e..eded13e 100644 --- a/task-manager/mongodb.js +++ b/task-manager/mongodb.js @@ -13,8 +13,50 @@ MongoClient.connect(connectionURL, { useNewUrlParser: true }, (error, client) => const db = client.db(databaseName) - db.collection('users').insertOne({ - name: 'Jason', - age: 38 + // db.collection('users').insertOne({ + // name: 'Jason', + // age: 38 + // }, (error, result) => { + // if (error) { + // return console.log('Unable to insert user') + // } + // + // console.log(result.ops) + // }) + + // db.collection('users').insertMany([ + // { + // name: 'Jen', + // age: 28 + // }, + // { + // name: 'Gunther', + // age: 27 + // } + // ], (error, result) => { + // if (error) { + // return console.log('Unable to insert documents') + // } + // + // console.log(result.ops) + // }) + + db.collection('tasks').insertMany([ + { + description: 'Install MongoDB', + completed: true + },{ + description: 'Complete the challenge for Video 76', + completed: false + },{ + description: 'Learn NodeJS', + completed: false + } + ], (error, result) => { + if (error) { + return console.log('Unable to insert documents') + } + + console.log(result.ops) }) })