Added Document.drop_collection, cleaned up tests

This commit is contained in:
Harry Marr
2009-11-21 20:32:29 +00:00
parent 8e89c8b37a
commit 70ee0f57ea
4 changed files with 30 additions and 21 deletions

View File

@@ -1,4 +1,5 @@
from base import DocumentMetaclass, TopLevelDocumentMetaclass, BaseDocument
from connection import _get_db
__all__ = ['Document', 'EmbeddedDocument']
@@ -18,3 +19,11 @@ class Document(BaseDocument):
it will be updated, otherwise it will be created.
"""
self.objects._save_document(self)
@classmethod
def drop_collection(cls):
"""Drops the entire collection associated with this Document type from
the database.
"""
db = _get_db()
db.drop_collection(cls._meta['collection'])