课程: Introduction to MongoDB

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Deleting documents in MongoDB

Deleting documents in MongoDB

- Hi folks. In this video, you'll learn how to delete documents in MongoDB by using deleteOne() and deleteMany(). Let's jump right into it. Imagine that you're working with a database that contains information about various podcasts. There's a single document for each podcast that gets added to the collection, which is called Podcasts, but there's a problem. At some point, a duplicate document for a podcast was inserted accidentally. We need to delete the duplicate. To achieve this, first, we'll use find() to determine which document to delete, and then we'll use the deleteOne() method. Furthermore, your managers ask you to remove all podcasts with a category of crime. First, we provide a filter document to the find() method that contains the uploaded date of the duplicate document which was provided to us by our manager. The date we were given is April 28th, 2020. In the Shell, we'll use the ISODate wrapper to…

内容