aswi2020sebela-gitlab/modules/crawler/ResetDatabaseData.py @ 587b1c57
1 |
from Utilities.Database import DatabaseLoader |
---|---|
2 |
|
3 |
|
4 |
def clean_database(): |
5 |
"""
|
6 |
Deletes all collections from database
|
7 |
"""
|
8 |
# Create connection
|
9 |
mydb = DatabaseLoader.create_database_connection() |
10 |
|
11 |
# Retrieve list of all collections
|
12 |
collections = mydb.list_collection_names() |
13 |
|
14 |
# Drop of all collections
|
15 |
for name in collections: |
16 |
mydb[name].drop() |
17 |
|
18 |
print("Database Cleaned") |
19 |
|
20 |
|
21 |
clean_database() |