deleteOne from mongoDB with mongoose in object display page support

  ejs, express, javascript, mongodb, mongoose

i am trying to remove a particular ‘ticket’ in this case from the database. the page displays a table of all the tickets and their seat name and price, and a delete button(form). However, the delete function (regardless of which one i select) only deletes the first ticket in the list.

here is controller function:

    Ticket.findOneAndDelete(, function(err) {
      console.log('deleting button works in Tickets router')

router:'/tickets/:id', ticketsCtrl.delete)

ejs snippet:

          <td><%= %></td>
          <td><%= t.price %></td>
          <form id="delete-ticket-form" method="POST"
          action="/tickets/<%= t._id %>">
          <input type="submit" value="X">

Source: Ask Javascript Questions