Commit 772e805e by Calen Pennington

Merge pull request #1748 from MITx/fix/cdodge/limit-fields-in-metadata-cache-computation

optimize the result-set that gets returned from Mongo on metadata inheri...
parents 8abba395 195fd2d1
...@@ -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