Add new meta option to Document: allow_index_creation.

Defaults to True. If set to False then MongoEngine will not ensure indexes exist
This commit is contained in:
Colin Howe
2012-03-19 20:27:08 +00:00
parent 61411bb259
commit 7e376b40bb
3 changed files with 77 additions and 47 deletions

View File

@@ -74,6 +74,11 @@ class Document(BaseDocument):
names. Index direction may be specified by prefixing the field names with
a **+** or **-** sign.
Index creation can be disabled by specifying :attr:`index_allow_creation` in
the :attr:`meta` dictionary. If this is set to True then indexes will not be
created by MongoEngine. This is useful in production systems where index
creation is performed as part of a deployment system.
By default, _types will be added to the start of every index (that
doesn't contain a list) if allow_inheritence is True. This can be
disabled by either setting types to False on the specific index or