fix error in adding

This commit is contained in:
Arjun Patel
2018-07-30 21:54:24 -07:00
parent 92a962a85d
commit e513c0858e
-6
View File
@@ -38,17 +38,11 @@ app.post('/insertorders', function (req, res) {
console.log('Connected to Database! Inserting orders'); console.log('Connected to Database! Inserting orders');
var db = client.db("heroku_rg3dpg4f"); var db = client.db("heroku_rg3dpg4f");
db.collection("orders").drop(function(err, delOK) {
if (err) throw err;
if (delOK) console.log("Collection deleted");
db.collection('orders').insertMany(orders, function (err, result) { db.collection('orders').insertMany(orders, function (err, result) {
if (err) return console.log(err); if (err) return console.log(err);
return console.log("INSERTED ALL ORDERS"); return console.log("INSERTED ALL ORDERS");
}); });
});
client.close(); client.close();
}); });