Closed barrycumbie closed 1 month ago
<h3> Current Drinkz on hand</h3>
<% for (var i=0; i< drinkData.length; i++ ) { %>
<form method="POST" action="/updateDrink/<%= drinkData[i]._id %>" style="display: inline-block">
<%= drinkData[i].drink_name %> (<%= drinkData[i].size %>)
<input type="submit" value="update">
</form>
<br/>
<% } %>
Needed the new keyword:
let result = await collection.findOneAndUpdate(
{"_id": new ObjectId(req.params.id)}, { $set: {"post": "NEW POST" } }
here's the video!
app.post('/updateDrink/:id', async (req, res) => {
try { console.log("req.parms.id: ", req.params.id)