Don't fetch entire project just to fetch a node type.
The query can probably be made more specific by including the node type beforehand, and only fetching that.
This commit is contained in:
parent
336ba7d6fe
commit
83bad3d88d
@ -54,10 +54,13 @@ class ValidateCustomFields(Validator):
|
||||
projects_collection = app.data.driver.db['projects']
|
||||
lookup = {'_id': ObjectId(self.document['project'])}
|
||||
|
||||
project = projects_collection.find_one(lookup)
|
||||
project = projects_collection.find_one(lookup, {
|
||||
'node_types.name': 1,
|
||||
'node_types.dyn_schema': 1,
|
||||
})
|
||||
if project is None:
|
||||
log.warning('Unknown project %s, declared by node %s',
|
||||
project, self.document.get('_id'))
|
||||
lookup, self.document.get('_id'))
|
||||
self._error(field, 'Unknown project')
|
||||
return False
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user