Spaces:
Sleeping
Sleeping
Download database/check_db.py from benedictpepper/fitmate-api: direct link, hf CLI and curl.
- Browser
- Download file 400 Bytes
-
https://huggingface.co/spaces/benedictpepper/fitmate-api/resolve/main/database/check_db.py
- Command line
-
hf download hf://spaces/benedictpepper/fitmate-api/database/check_db.py
-
curl -L -o check_db.py https://huggingface.co/spaces/benedictpepper/fitmate-api/resolve/main/database/check_db.py
400 Bytes
| import asyncio | |
| import os | |
| from motor.motor_asyncio import AsyncIOMotorClient | |
| async def check(): | |
| client = AsyncIOMotorClient(os.getenv("MONGODB_URL", "mongodb://localhost:27017")) | |
| db = client.get_database(os.getenv("MONGODB_DB_NAME", "fitmate_db")) | |
| c = await db["tcm_ingredients"].count_documents({}) | |
| print(f"Total documents: {c}") | |
| if __name__ == "__main__": | |
| asyncio.run(check()) | |