import os
from pymongo import MongoClient
from dotenv import load_dotenv


def database_entry(data):
    try:
        load_dotenv()
        mongo_string = os.getenv('MONGODB_AUTH_URI')
        client = MongoClient(mongo_string)
        database = client[os.getenv('MONGODB_DB')]
        col = database['users']
        col.insert_one(data)
        return True
    except Exception as e:
        print(e)
        return False


if __name__ == "__main__":
    pass

[((118, 131), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (129, 131), False, 'from dotenv import load_dotenv\n'), ((155, 184), 'os.getenv', 'os.getenv', (['"""MONGODB_AUTH_URI"""'], {}), "('MONGODB_AUTH_URI')\n", (164, 184), False, 'import os\n'), ((202, 227), 'pymongo.MongoClient', 'MongoClient', (['mongo_string'], {}), '(mongo_string)\n', (213, 227), False, 'from pymongo import MongoClient\n'), ((254, 277), 'os.getenv', 'os.getenv', (['"""MONGODB_DB"""'], {}), "('MONGODB_DB')\n", (263, 277), False, 'import os\n')]