from flask import current_app
from flask import g
from pymongo import MongoClient

#get database for each request
def get_db():
    if "db" not in g:
        client = MongoClient()
        db_name = current_app.config['DATABASE']
        g.db = client[db_name]

    return g.db

1405dfce27de1a2d8e2b24bf3fcd20bd6527ebc4
<mask token>

<mask token>


def get_db():
    if 'db' not in g:
        client = MongoClient()
        db_name = current_app.config['DATABASE']
        g.db = client[db_name]
    return g.db

from flask import current_app
from flask import g
from pymongo import MongoClient


def get_db():
    if 'db' not in g:
        client = MongoClient()
        db_name = current_app.config['DATABASE']
        g.db = client[db_name]
    return g.db

from flask import current_app
from flask import g
from pymongo import MongoClient

#get database for each request
def get_db():
    if "db" not in g:
        client = MongoClient()
        db_name = current_app.config['DATABASE']
        g.db = client[db_name]

    return g.db
