📅Database¶
Database¶
- class GoldyBot.goldy.database.Database(goldy: Goldy)[source]¶
Bases:
object
Goldy Bot’s class to interface with a Mongo Database asynchronously.
- async create_collection(database: DatabaseEnums | str, collection_name: str, data) bool [source]¶
- async delete_collection(database: DatabaseEnums | str, collection_name: str) bool [source]¶
- async edit(database: DatabaseEnums | str, collection: str, query, data: dict, overwrite: bool = False) bool [source]¶
Finds and edits a document in this database and collection with the data provided.
- async find(database: DatabaseEnums | str, collection: str, query, key: str, max_to_find=50) List[dict] [source]¶
Searches for and returns documents with that query in a collection in this database.
- async find_all(database: DatabaseEnums | str, collection: str, max_to_find=100) List[dict] | None [source]¶
Finds and returns all documents in a collection from this database. This took me a day to make! 😞
- async find_one(database: DatabaseEnums | str, collection: str, query: dict) dict | None [source]¶
Searches for and returns specific data from a collection in this database.
- async get_collection(database: DatabaseEnums | str, collection: str)[source]¶
Returns cursor of the following collection.
- get_goldy_database(database_name: DatabaseEnums | str) GoldyDB [source]¶
Returns an instance of
GoldyDB()
.
- async insert(database: DatabaseEnums | str, collection: str, data) bool [source]¶
Inserts the data provided into a collection in this database.
- async list_collection_names(database: DatabaseEnums | str) List[str] [source]¶
Returns list of all collection name in this database.
- async remove(database: DatabaseEnums | str, collection: str, data) bool [source]¶
Finds and deletes a copy of this data from a collection in this database.
- class GoldyBot.goldy.database.DatabaseEnums(value)[source]¶
Bases:
Enum
Enum class that holds the code names for all goldy bot pymongo databases and collection types.
- GOLDY_MAIN = 'goldy_main'¶
- GOLDY_MEMBER_DATA = 'goldy_member_data'¶
- MEMBER_GLOBAL_DATA = 'member_global_data'¶
- MEMBER_GUILD_DATA = 'member_guild_data'¶