🎪Databases

Databases

class GoldyBot.goldy.database.databases.GoldyDB(core_database: Database, db_code_name: str)[source]

Bases: object

A class representing a singular goldy bot database in mongoDB.

async create_collection(collection_name: str, data) None[source]
async delete_collection(collection_name: str) None[source]
async edit(collection: str, query, data: dict, overwrite: bool = False) dict[source]

Finds and edits a document in this database and collection with the data provided.

async find(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(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(collection: str, query: dict) dict | None[source]

Searches for and returns specific data (document) from a collection in this database.

async get_collection(collection: str)[source]

Returns cursor of the following collection.

async insert(collection: str, data) None[source]

Inserts the data provided into a collection in this database. Creates a whole new document. If you want to edit an existing document use .edit()

async list_collection_names() List[str][source]

Returns list of all collection name in this database.

async remove(collection: str, data) None[source]

Finds and deletes a copy of this data from a collection in this database.