Using the deleteMany and findOneAndDelete methods

We're going to go ahead and go over a quick challenge to test your skills. Inside of Robomongo, we can look at the data we have in the Users collection. I'm going to open it up, highlight all the data, and expand it recursively so we can view it:

We have the name Jen; we have Mike; we have Andrew, Andrew and Andrew. This is perfect data. Yours might look a little different, but the goal is to use two methods. First up, look for any duplicates, anything that has a name set to the name of another document. In this case, I have three documents where the name is Andrew. What I want to do is use ...

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.