def get(self): # TODO: Add sort by time! """Query event_descriptor documents""" query = utils._unpack_params(self) start = query.pop('range_floor') stop = query.pop('range_ceil') cursor = db.event_descriptor.find(query).sort('time', pymongo.DESCENDING)[start:stop] docs = yield cursor.to_list(None) self.write(json_util.dumps(docs)) self.finish()
def get(self): query = utils._unpack_params(self) start = query.pop('range_floor') stop = query.pop('range_ceil') docs = yield db.run_start.find(query).sort( 'time', pymongo.ASCENDING)[start:stop].to_list(None) if not docs: raise tornado.web.HTTPError(404) else: utils._return2client(self, utils._stringify_data(docs)) self.finish()
def get(self): query = utils._unpack_params(self) start = query.pop('range_floor') stop = query.pop('range_ceil') docs = yield db.event_descriptor.find(query).sort( 'time', pymongo.ASCENDING)[start:stop].to_list(None) if not docs: raise tornado.web.HTTPError(404) else: for d in docs: run_start_id = d.pop('run_start_id') rstart = yield db.run_start.find_one({'run_start_id': run_start_id}) d['run_start'] = rstart utils._return2client(self, utils._stringify_data(docs)) self.finish()