From 320956a21399f5d36aa441fce9c51a2285f637b4 Mon Sep 17 00:00:00 2001 From: Nathaniel Kofalt <nathaniel@kofalt.com> Date: Thu, 5 May 2016 15:37:43 -0500 Subject: [PATCH] Fiddle with query --- api/jobs.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/api/jobs.py b/api/jobs.py index 2c73135b..f806f070 100644 --- a/api/jobs.py +++ b/api/jobs.py @@ -53,21 +53,17 @@ def get_gears(): def get_gear_by_name(name): # Find a gear from the list by name - gear_doc = config.db.static.find_one({ - "_id": "gears", - "gear_list": { - "$elemMatch": { - "name": name - } - } - }, { - "gear_list.$": 1 + gear_doc = config.db.static.find_one( + {'_id': 'gears'}, + {'gear_list': { '$elemMatch': { + 'name': 'dcm_convert' + }} }) if gear_doc is None: - raise Exception("Unknown gear " + name) + raise Exception('Unknown gear ' + name) - # Mongo returns the full document: { "_id" : "gears", "gear_list" : [ { .. } ] }, so strip that out + # Mongo returns the full document: { '_id' : 'gears', 'gear_list' : [ { .. } ] }, so strip that out return gear_doc['gear_list'][0] def queue_job_legacy(db, algorithm_id, input, tags=None, attempt_n=1, previous_job_id=None): -- GitLab