Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.get('/delete:id', (req, res,next) => {
- var id = req.params.id;
- console.log(id);
- var myquery = { Empid:id};
- db.collection("emp").remove(myquery, function(err, obj) {
- if (err) throw err;
- res.redirect('/');
- console.log(obj.result.n + " document(s) deleted");
- db.close();
- });
- });
- <table class="emp" border="1" id="emptable">
- <thead>
- <tr>
- <th>_id</th>
- <th>EmpId</th>
- <th>Name</th>
- <th>Mobile</th>
- <th>Email_id</th>
- <th>Designation</th>
- <th>Company</th>
- <th>Experience</th>
- <th>Work Details</th>
- <th>Address</th>
- <th>City</th>
- <th>State</th>
- <th>PinCode</th>
- <th>Action</th>
- </tr>
- </thead>
- <tbody>
- <% for(var i=0; i < emp.length; i++) { %>
- <tr>
- <td><%= emp[i]._id %></td>
- <td><%= emp[i].Empid %></td>
- <td><%= emp[i].Name %></td>
- <td><%= emp[i].Mobile %></td>
- <td><%= emp[i].Email_id %></td>
- <td><%= emp[i].Designation %></td>
- <td><%= emp[i].Company %></td>
- <td><%= emp[i].Experience %></td>
- <td><%= emp[i].Work %></td>s
- <td><%= emp[i].Address%></td>
- <td><%= emp[i].City %></td>
- <td><%= emp[i].State %></td>
- <td><%= emp[i].Pincode %></td>
- <td><a href='/delete' action='/'><%id= emp[i].Empid %>Delete</a>
- </td>
Add Comment
Please, Sign In to add comment