

def _resource_mongo(d, collection_name=None):
    client = pymongo.MongoClient(d['hostport'])
    db = getattr(client, d['database'])
    if d.get('user'):
        db.authenticate(d['user'], db['pass'])
    if (collection_name is None):
        return db
    return getattr(db, collection_name)

dataset/ETHPy150Open blaze/odo/odo/backends/mongo.py _resource_mongo/VarMisuse@57/73 `d`->`db`