clear everytime entering into db
This commit is contained in:
@@ -32,9 +32,15 @@ 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').insertMany(orders, function (err, result) {
|
db.collection("customers").drop(function(err, delOK) {
|
||||||
if (err) return console.log(err);
|
if (err) throw err;
|
||||||
return console.log("INSERTED ALL ORDERS");
|
if (delOK) console.log("Collection deleted");
|
||||||
|
|
||||||
|
db.collection('orders').insertMany(orders, function (err, result) {
|
||||||
|
if (err) return console.log(err);
|
||||||
|
return console.log("INSERTED ALL ORDERS");
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
client.close();
|
client.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user