Remove documents from MongoDB

Delete a Single Document

Removing a document from MongoDB using Djongo is simple.

from app.models import Entry

entry = Entry.objects.get(headline='h2')
entry.delete()  
copy code

Delete Multiple Documents

from app.models import Entry

Entry.objects.Post.objects.filter(published_date__year__lte=2024).delete()
copy code