MongoDocuments Package¶
Config¶
-
class
mongoDocuments.Config(*args, **values)¶ Bases:
mongoengine.document.DynamicDocument-
exception
DoesNotExist¶ Bases:
mongoengine.errors.DoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
mongoengine.errors.MultipleObjectsReturned
-
__objects¶
-
_auto_id_field= True¶
-
_cached_reference_fields= []¶
-
_class_name= 'Config'¶
-
_collection= None¶
-
_db_field_map= {'commitDate': 'commitDate', 'commitMessage': 'commitMessage', 'commitSHA': 'commitSHA', 'compDeleteHash': 'compDeleteHash', 'compImgurLink': 'compImgurLink', 'date': 'date', 'failure': 'failure', 'id': '_id', 'name': 'name', 'perfDeleteHash': 'perfDeleteHash', 'perfImgurLink': 'perfImgurLink', 'setup': 'setup', 'system': 'system', 'unique': 'unique'}¶
-
_fields= {'commitDate': <mongoengine.fields.DateTimeField object>, 'commitMessage': <mongoengine.fields.StringField object>, 'commitSHA': <mongoengine.fields.StringField object>, 'compDeleteHash': <mongoengine.fields.StringField object>, 'compImgurLink': <mongoengine.fields.URLField object>, 'date': <mongoengine.fields.DateTimeField object>, 'failure': <mongoengine.fields.StringField object>, 'id': <mongoengine.base.fields.ObjectIdField object>, 'name': <mongoengine.fields.StringField object>, 'perfDeleteHash': <mongoengine.fields.StringField object>, 'perfImgurLink': <mongoengine.fields.URLField object>, 'setup': <mongoengine.fields.ReferenceField object>, 'system': <mongoengine.fields.StringField object>, 'unique': <mongoengine.fields.StringField object>}¶
-
_fields_ordered= ('id', 'name', 'date', 'commitSHA', 'commitDate', 'commitMessage', 'system', 'unique', 'setup', 'perfImgurLink', 'compImgurLink', 'perfDeleteHash', 'compDeleteHash', 'failure')¶
-
_is_base_cls= False¶
-
_is_document= True¶
-
_meta= {'abstract': False, 'allow_inheritance': None, 'collection': 'config', 'delete_rules': None, 'id_field': 'id', 'index_background': False, 'index_drop_dups': False, 'index_opts': None, 'index_specs': [{'fields': [('commitSHA', 1)]}, {'fields': [('unique', 1)], 'unique': True, 'sparse': True}], 'indexes': ['commitSHA'], 'max_documents': None, 'max_size': None, 'ordering': []}¶
-
_reverse_db_field_map= {'_id': 'id', 'commitDate': 'commitDate', 'commitMessage': 'commitMessage', 'commitSHA': 'commitSHA', 'compDeleteHash': 'compDeleteHash', 'compImgurLink': 'compImgurLink', 'date': 'date', 'failure': 'failure', 'name': 'name', 'perfDeleteHash': 'perfDeleteHash', 'perfImgurLink': 'perfImgurLink', 'setup': 'setup', 'system': 'system', 'unique': 'unique'}¶
-
_subclasses= ('Config',)¶
-
_superclasses= ()¶
-
_types= ('Config',)¶
-
commitDate¶ Datetime field.
Uses the python-dateutil library if available alternatively use time.strptime to parse the dates. Note: python-dateutil’s parser is fully featured and when installed you can utilise it to convert varying types of date formats into valid python datetime objects.
Note: To default the field to the current datetime, use: DateTimeField(default=datetime.utcnow)
- Note: Microseconds are rounded to the nearest millisecond.
Pre UTC microsecond support is effectively broken. Use
ComplexDateTimeFieldif you need accurate microsecond support.
-
commitMessage¶ A unicode string field.
-
commitSHA¶ A unicode string field.
-
compDeleteHash¶ A unicode string field.
-
compImgurLink¶ A field that validates input as an URL.
New in version 0.3.
-
date¶ Datetime field.
Uses the python-dateutil library if available alternatively use time.strptime to parse the dates. Note: python-dateutil’s parser is fully featured and when installed you can utilise it to convert varying types of date formats into valid python datetime objects.
Note: To default the field to the current datetime, use: DateTimeField(default=datetime.utcnow)
- Note: Microseconds are rounded to the nearest millisecond.
Pre UTC microsecond support is effectively broken. Use
ComplexDateTimeFieldif you need accurate microsecond support.
-
failure¶ A unicode string field.
-
id¶ A field wrapper around MongoDB’s ObjectIds.
-
name¶ A unicode string field.
-
objects¶ The default QuerySet Manager.
Custom QuerySet Manager functions can extend this class and users can add extra queryset functionality. Any custom manager methods must accept a
Documentclass as its first argument, and aQuerySetas its second argument.The method function should return a
QuerySet, probably the same one that was passed in, but modified in some way.
-
perfDeleteHash¶ A unicode string field.
-
perfImgurLink¶ A field that validates input as an URL.
New in version 0.3.
-
setup¶ A reference to a document that will be automatically dereferenced on access (lazily).
Note this means you will get a database I/O access everytime you access this field. This is necessary because the field returns a
Documentwhich precise type can depend of the value of the _cls field present in the document in database. In short, using this type of field can lead to poor performances (especially if you access this field only to retrieve it pk field which is already known before dereference). To solve this you should consider using theLazyReferenceField.Use the reverse_delete_rule to handle what should happen if the document the field is referencing is deleted. EmbeddedDocuments, DictFields and MapFields does not support reverse_delete_rule and an InvalidDocumentError will be raised if trying to set on one of these Document / Field types.
The options are:
DO_NOTHING (0) - don’t do anything (default).
NULLIFY (1) - Updates the reference to null.
CASCADE (2) - Deletes the documents associated with the reference.
DENY (3) - Prevent the deletion of the reference object.
PULL (4) - Pull the reference from a
ListFieldof references
Alternative syntax for registering delete rules (useful when implementing bi-directional delete rules)
class Org(Document): owner = ReferenceField('User') class User(Document): org = ReferenceField('Org', reverse_delete_rule=CASCADE) User.register_delete_rule(Org, 'owner', DENY)
Changed in version 0.5: added reverse_delete_rule
-
system¶ A unicode string field.
-
unique¶ A unicode string field.
-
exception
QueueObject¶
-
class
mongoDocuments.QueueObject(*args, **values)¶ Bases:
mongoengine.document.Document-
exception
DoesNotExist¶ Bases:
mongoengine.errors.DoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
mongoengine.errors.MultipleObjectsReturned
-
__objects¶
-
_auto_id_field= True¶
-
_cached_reference_fields= []¶
-
_class_name= 'QueueObject'¶
-
_collection= None¶
-
_db_field_map= {'commitSHA': 'commitSHA', 'compareUrl': 'compareUrl', 'id': '_id', 'installID': 'installID', 'runUrl': 'runUrl', 'running': 'running', 'status': 'status'}¶
-
_fields= {'commitSHA': <mongoengine.fields.StringField object>, 'compareUrl': <mongoengine.fields.URLField object>, 'id': <mongoengine.base.fields.ObjectIdField object>, 'installID': <mongoengine.fields.IntField object>, 'runUrl': <mongoengine.fields.URLField object>, 'running': <mongoengine.fields.BooleanField object>, 'status': <mongoengine.fields.StringField object>}¶
-
_fields_ordered= ('id', 'commitSHA', 'running', 'installID', 'status', 'runUrl', 'compareUrl')¶
-
_is_base_cls= False¶
-
_is_document= True¶
-
_meta= {'abstract': False, 'allow_inheritance': None, 'collection': 'queue_object', 'delete_rules': None, 'id_field': 'id', 'index_background': False, 'index_drop_dups': False, 'index_opts': None, 'index_specs': [{'fields': [('commitSHA', 1)], 'unique': True, 'sparse': False}], 'indexes': ['commitSHA'], 'max_documents': None, 'max_size': None, 'ordering': []}¶
-
_reverse_db_field_map= {'_id': 'id', 'commitSHA': 'commitSHA', 'compareUrl': 'compareUrl', 'installID': 'installID', 'runUrl': 'runUrl', 'running': 'running', 'status': 'status'}¶
-
_subclasses= ('QueueObject',)¶
-
_superclasses= ()¶
-
_types= ('QueueObject',)¶
-
commitSHA¶ A unicode string field.
-
compareUrl¶ A field that validates input as an URL.
New in version 0.3.
-
id¶ A field wrapper around MongoDB’s ObjectIds.
-
installID¶ 32-bit integer field.
-
objects¶ The default QuerySet Manager.
Custom QuerySet Manager functions can extend this class and users can add extra queryset functionality. Any custom manager methods must accept a
Documentclass as its first argument, and aQuerySetas its second argument.The method function should return a
QuerySet, probably the same one that was passed in, but modified in some way.
-
runUrl¶ A field that validates input as an URL.
New in version 0.3.
-
running¶ Boolean field type.
New in version 0.1.2.
-
status¶ A unicode string field.
-
exception
Result¶
-
class
mongoDocuments.Result(*args, **values)¶ Bases:
mongoengine.document.DynamicDocumentHolding results for a given config
-
exception
DoesNotExist¶ Bases:
mongoengine.errors.DoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
mongoengine.errors.MultipleObjectsReturned
-
__objects¶
-
_auto_id_field= True¶
-
_cached_reference_fields= []¶
-
_class_name= 'Result'¶
-
_collection= None¶
-
_db_field_map= {'config': 'config', 'id': '_id', 'meanTime': 'meanTime', 'measurements': 'measurements', 'minTime': 'minTime'}¶
-
_fields= {'config': <mongoengine.fields.ReferenceField object>, 'id': <mongoengine.base.fields.ObjectIdField object>, 'meanTime': <mongoengine.fields.FloatField object>, 'measurements': <mongoengine.fields.ListField object>, 'minTime': <mongoengine.fields.FloatField object>}¶
-
_fields_ordered= ('id', 'config', 'measurements', 'meanTime', 'minTime')¶
-
_is_base_cls= False¶
-
_is_document= True¶
-
_meta= {'abstract': False, 'allow_inheritance': None, 'collection': 'result', 'delete_rules': None, 'id_field': 'id', 'index_background': False, 'index_drop_dups': False, 'index_opts': None, 'index_specs': [{'fields': [('config', 1)]}], 'indexes': ['config'], 'max_documents': None, 'max_size': None, 'ordering': []}¶
-
_reverse_db_field_map= {'_id': 'id', 'config': 'config', 'meanTime': 'meanTime', 'measurements': 'measurements', 'minTime': 'minTime'}¶
-
_subclasses= ('Result',)¶
-
_superclasses= ()¶
-
_types= ('Result',)¶
-
config¶ A reference to a document that will be automatically dereferenced on access (lazily).
Note this means you will get a database I/O access everytime you access this field. This is necessary because the field returns a
Documentwhich precise type can depend of the value of the _cls field present in the document in database. In short, using this type of field can lead to poor performances (especially if you access this field only to retrieve it pk field which is already known before dereference). To solve this you should consider using theLazyReferenceField.Use the reverse_delete_rule to handle what should happen if the document the field is referencing is deleted. EmbeddedDocuments, DictFields and MapFields does not support reverse_delete_rule and an InvalidDocumentError will be raised if trying to set on one of these Document / Field types.
The options are:
DO_NOTHING (0) - don’t do anything (default).
NULLIFY (1) - Updates the reference to null.
CASCADE (2) - Deletes the documents associated with the reference.
DENY (3) - Prevent the deletion of the reference object.
PULL (4) - Pull the reference from a
ListFieldof references
Alternative syntax for registering delete rules (useful when implementing bi-directional delete rules)
class Org(Document): owner = ReferenceField('User') class User(Document): org = ReferenceField('Org', reverse_delete_rule=CASCADE) User.register_delete_rule(Org, 'owner', DENY)
Changed in version 0.5: added reverse_delete_rule
-
id¶ A field wrapper around MongoDB’s ObjectIds.
-
meanTime¶ Floating point number field.
-
measurements¶ A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.
If using with ReferenceFields see: one-to-many-with-listfields
Note
Required means it cannot be empty - as the default for ListFields is []
-
minTime¶ Floating point number field.
-
objects¶ The default QuerySet Manager.
Custom QuerySet Manager functions can extend this class and users can add extra queryset functionality. Any custom manager methods must accept a
Documentclass as its first argument, and aQuerySetas its second argument.The method function should return a
QuerySet, probably the same one that was passed in, but modified in some way.
-
exception
Setup¶
-
class
mongoDocuments.Setup(*args, **values)¶ Bases:
mongoengine.document.DynamicDocumentHolding .yaml file used for performance testing runs
-
exception
DoesNotExist¶ Bases:
mongoengine.errors.DoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
mongoengine.errors.MultipleObjectsReturned
-
__objects¶
-
_auto_id_field= True¶
-
_cached_reference_fields= []¶
-
_class_name= 'Setup'¶
-
_collection= None¶
-
_db_field_map= {'active': 'active', 'id': '_id', 'name': 'name', 'uploadDate': 'uploadDate', 'yaml': 'yaml', 'yamlHash': 'yamlHash'}¶
-
_fields= {'active': <mongoengine.fields.BooleanField object>, 'id': <mongoengine.base.fields.ObjectIdField object>, 'name': <mongoengine.fields.StringField object>, 'uploadDate': <mongoengine.fields.DateTimeField object>, 'yaml': <mongoengine.fields.StringField object>, 'yamlHash': <mongoengine.fields.StringField object>}¶
-
_fields_ordered= ('id', 'name', 'yaml', 'yamlHash', 'active', 'uploadDate')¶
-
_is_base_cls= False¶
-
_is_document= True¶
-
_meta= {'abstract': False, 'allow_inheritance': None, 'collection': 'setup', 'delete_rules': None, 'id_field': 'id', 'index_background': False, 'index_drop_dups': False, 'index_opts': None, 'index_specs': [{'fields': [('yamlHash', 1)], 'unique': True, 'sparse': False}], 'indexes': [], 'max_documents': None, 'max_size': None, 'ordering': []}¶
-
_reverse_db_field_map= {'_id': 'id', 'active': 'active', 'name': 'name', 'uploadDate': 'uploadDate', 'yaml': 'yaml', 'yamlHash': 'yamlHash'}¶
-
_subclasses= ('Setup',)¶
-
_superclasses= ()¶
-
_types= ('Setup',)¶
-
active¶ Boolean field type.
New in version 0.1.2.
-
id¶ A field wrapper around MongoDB’s ObjectIds.
-
name¶ A unicode string field.
-
objects¶ The default QuerySet Manager.
Custom QuerySet Manager functions can extend this class and users can add extra queryset functionality. Any custom manager methods must accept a
Documentclass as its first argument, and aQuerySetas its second argument.The method function should return a
QuerySet, probably the same one that was passed in, but modified in some way.
-
uploadDate¶ Datetime field.
Uses the python-dateutil library if available alternatively use time.strptime to parse the dates. Note: python-dateutil’s parser is fully featured and when installed you can utilise it to convert varying types of date formats into valid python datetime objects.
Note: To default the field to the current datetime, use: DateTimeField(default=datetime.utcnow)
- Note: Microseconds are rounded to the nearest millisecond.
Pre UTC microsecond support is effectively broken. Use
ComplexDateTimeFieldif you need accurate microsecond support.
-
yaml¶ A unicode string field.
-
yamlHash¶ A unicode string field.
-
exception