Allow current_app.db('collections-name')
This mimics the use in Flamenco (current_flamenco.db('collection_name')), and makes calling code a bit nicer (db('coll') instead of db()['coll'])
This commit is contained in:
parent
319f815985
commit
a6617cae68
@ -551,12 +551,14 @@ class PillarServer(Eve):
|
||||
|
||||
pprint(links)
|
||||
|
||||
def db(self):
|
||||
def db(self, collection_name: str=None):
|
||||
"""Returns the MongoDB database.
|
||||
|
||||
:rtype: flask_pymongo.PyMongo
|
||||
"""
|
||||
|
||||
if collection_name:
|
||||
return self.data.driver.db[collection_name]
|
||||
return self.data.driver.db
|
||||
|
||||
def extension_sidebar_links(self, project):
|
||||
|
Loading…
x
Reference in New Issue
Block a user