mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 18:27:59 -05:00
[V3 Config] Implement a true clear method (#1344)
* Add clear methods to drivers * Update config clear methods, add to Value * Add test
This commit is contained in:
@@ -71,7 +71,7 @@ class Mongo(BaseDriver):
|
||||
uuid, identifiers = identifiers[0], identifiers[1:]
|
||||
return uuid, identifiers
|
||||
|
||||
async def get(self, *identifiers: Tuple[str]):
|
||||
async def get(self, *identifiers: str):
|
||||
await self._ensure_connected()
|
||||
|
||||
mongo_collection = self.get_collection()
|
||||
@@ -104,6 +104,17 @@ class Mongo(BaseDriver):
|
||||
upsert=True
|
||||
)
|
||||
|
||||
async def clear(self, *identifiers: str):
|
||||
await self._ensure_connected()
|
||||
|
||||
dot_identifiers = '.'.join(identifiers)
|
||||
mongo_collection = self.get_collection()
|
||||
|
||||
await mongo_collection.update_one(
|
||||
{'_id': self.unique_cog_identifier},
|
||||
update={"$unset": {dot_identifiers: 1}}
|
||||
)
|
||||
|
||||
|
||||
def get_config_details():
|
||||
host = input("Enter host address: ")
|
||||
|
||||
Reference in New Issue
Block a user