Deleting an Item From MongoDB Mongoose By User Permission

The first thing you learn when building a web application is CRUD, Create Read, Update and Destroy. I was learning Node.js to build the backend of my application. The first few lessons were about creating data, and then editing it. In MongoDB mongoose, there are some handy commands for creating, editing items. Let’s say I have a blog post which I created. To edit it, I call the .findOneAndUpdate() method for editing the existing collection. I soon figured out there must be a .removeOne() or .deleteOne() method to delete an item from the database collection. I gave that a try. …

Read More