24 lines
616 B
Python
24 lines
616 B
Python
from __future__ import annotations
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
from core.database import connect
|
|
from core.database import total_documents
|
|
|
|
if __name__ == '__main__':
|
|
# prepare env vars
|
|
env_path = Path(__file__).parent.parent / 'local.env'
|
|
assert env_path.exists()
|
|
load_dotenv(env_path)
|
|
os.environ['MONGO_HOST'] = 'localhost'
|
|
# connect to database
|
|
collection, db, client = connect()
|
|
# get visual communication
|
|
num_docs = total_documents(
|
|
collection=collection,
|
|
)
|
|
print(f"total number of documents in database: {num_docs}")
|