Running the findOneAndDelete and deleteMany statements

Let's go ahead and comment out findOneAndDelete first. We'll run the deleteMany statement. Over in the Terminal, I can shut down the current connection, start it up again, and if we go over to Robomongo, we should see that those three documents were deleted. I'm going to right-click on Users and view the documents:

We just get the two documents back. Anything where the name was Andrew is now removed, which means our statement worked as expected, and this is fantastic.

Next up, we can run our findOneAndDelete statement. In this case, we're expecting that that one document, the one where ...

Get Advanced Node.js Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.