def get_db_config():
    """Retrieves the database config.

    Returns:
        a :class:`DatabaseConfigDocument`
    """
    conn = get_db_conn()

    config_docs = list(conn.config.find())
    if config_docs:
        if len(config_docs) > 1:
            config_doc = _handle_multiple_config_docs(conn, config_docs)
        else:
            config_doc = config_docs[0]

        config = DatabaseConfigDocument(conn, **config_doc)
        save = False
    else:
        config = DatabaseConfigDocument(conn)
        save = True

    if config.version is None:
        #
        # If the database has no version, then assume the version of the client
        # that is currently connecting to it.
        #
        # This needs to be implemented here rather than in a migration because
        # this information is required in order to run migrations...
        #
        config.version = foc.VERSION
        save = True

    if config.type is None:
        #
        # If the database has no type, then assume the type of the client that
        # is currently connecting to it.
        #
        # This needs to be implemented here rather than in a migration because
        # this information is required in order to decide if a client is
        # allowed to connect to the database at all (a precursor to running a
        # migration)...
        #
        config.type = foc.CLIENT_TYPE
        save = True

    if save:
        config.save()

    return config
Retrieves the database config.

    Returns:
        a :class:`DatabaseConfigDocument`
    
fiftyone/core/odm/database.py