'Returns the last document stored in Mongo.'

@wrap_exceptions
def get_last_doc(self):

    def docs_by_ts():
        for meta_collection_name in self._meta_collections():
            meta_coll = self.meta_database[meta_collection_name]
            for ts_ns_doc in meta_coll.find(limit=(-1)).sort('_ts', (-1)):
                (yield ts_ns_doc)
    return max(docs_by_ts(), key=(lambda x: x['_ts']))
