Deleting documents

Deleting an API is similar to updating—using QuerySet to find the affected documents and then chaining on a .delete() method to delete them:

>>> User.objects.raw({'first_name': {'$exists': True}}).delete()

BulkWrite API is still not supported at the time of writing this book (June 2017) and the relevant ticket, PYMODM-43, is open. Methods such as bulk_create() will, under the hood, issue multiple commands to the database.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.52.234