def get_history(asset_id, document_limit=10):
try:
cursor = app.config['DB_COLL_HISTORY'].find(
{'asset_id': asset_id}
).sort(
"timestamp", pymongo.DESCENDING
).limit(int(document_limit))
except pymongo.errors.AutoReconnect as e:
logger.error(e.message)
except Exception as e:
logger.error(e.message)
history = []
for document in cursor:
doc = utilities.to_isoformat_datetime(document)
history.append(doc)
return dumps(history)
评论列表
文章目录