forked from technolyceum/ai6-m2
Updated starter pack
This commit is contained in:
19
starter_templates/docs/roles/database-designer-danil.md
Normal file
19
starter_templates/docs/roles/database-designer-danil.md
Normal file
@@ -0,0 +1,19 @@
|
||||
// 1. This file should contain database connection information
|
||||
// TODO: Import MongoDB driver (line 1)
|
||||
import pymongo
|
||||
|
||||
// TODO: Connect to MongoDB using the connection URI (line 3-5)
|
||||
client = pymongo.MongoClient("mongodb://localhost:27017/")
|
||||
|
||||
// TODO: Select the appropriate database (line 7)
|
||||
db = client["student_db"]
|
||||
|
||||
// TODO: Select the questions collection (line 9)
|
||||
questions_collection = db["questions"]
|
||||
|
||||
// TODO: Add error handling for database connection (line 11)
|
||||
try:
|
||||
client.admin.command('ping')
|
||||
print("Successfully connected to MongoDB!")
|
||||
except Exception as e:
|
||||
print(f"MongoDB connection error: {e}")
|
||||
Reference in New Issue
Block a user