Commit 195fd2d1 by Chris Dodge

optimize the result-set that gets returned from Mongo on metadata inheritence.…

optimize the result-set that gets returned from Mongo on metadata inheritence. We just need the fields which are actually inheritable, so no need to return anything else as it gets filtered out during the computation
parent 8abba395
...@@ -267,8 +267,13 @@ class MongoModuleStore(ModuleStoreBase): ...@@ -267,8 +267,13 @@ class MongoModuleStore(ModuleStoreBase):
'_id.course': location.course, '_id.course': location.course,
'_id.category': {'$in': ['course', 'chapter', 'sequential', 'vertical']} '_id.category': {'$in': ['course', 'chapter', 'sequential', 'vertical']}
} }
# we just want the Location, children, and metadata # we just want the Location, children, and inheritable metadata
record_filter = {'_id': 1, 'definition.children': 1, 'metadata': 1} record_filter = {'_id': 1, 'definition.children': 1}
# just get the inheritable metadata since that is all we need for the computation
# this minimizes both data pushed over the wire
for attr in INHERITABLE_METADATA:
record_filter['metadata.{0}'.format(attr)] = 1
# call out to the DB # call out to the DB
resultset = self.collection.find(query, record_filter) resultset = self.collection.find(query, record_filter)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment