MongoDB Delete Document

The db.collection.remove() method will remove the document or documents from the collection. It’s syntax is as follows

 db.collection.remove(   <query>,   <justOne>)

if justOne: set to true limits removal of documents to justOne instead of all if multiple records matched for the query


>_ Remove a single document having userid “Andrew”


>_ Remove all users having Age >25


>_ Remove all records of 'users' collection

Copyright © 2018-2020 TutorialToUs. All rights reserved.