Spaces:
Sleeping
Sleeping
Create seed_businesses.py
Browse files- seed_businesses.py +36 -0
seed_businesses.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pymongo
|
2 |
+
|
3 |
+
# Replace with your real MongoDB connection string
|
4 |
+
client = pymongo.MongoClient("mongodb+srv://puseletso55:Daniel%[email protected]/?retryWrites=true&w=majority&appName=TownshipBusinessChatbot")
|
5 |
+
db = client["township_db"]
|
6 |
+
collection = db["businesses"]
|
7 |
+
|
8 |
+
sample_businesses = [
|
9 |
+
{
|
10 |
+
"name": "Mama Rose Kitchen",
|
11 |
+
"description": "Traditional home-cooked meals",
|
12 |
+
"address": "123 Soweto Main Rd",
|
13 |
+
"phone": "+27 71 234 5678",
|
14 |
+
"latitude": -26.2708,
|
15 |
+
"longitude": 27.8584
|
16 |
+
},
|
17 |
+
{
|
18 |
+
"name": "Bongani's Mechanics",
|
19 |
+
"description": "Affordable car repairs and maintenance",
|
20 |
+
"address": "45 Tembisa Street",
|
21 |
+
"phone": "+27 72 345 6789",
|
22 |
+
"latitude": -26.0046,
|
23 |
+
"longitude": 28.2268
|
24 |
+
},
|
25 |
+
{
|
26 |
+
"name": "Noko Beauty Salon",
|
27 |
+
"description": "Hair and beauty treatments",
|
28 |
+
"address": "67 Mamelodi Avenue",
|
29 |
+
"phone": "+27 73 456 7890",
|
30 |
+
"latitude": -25.7170,
|
31 |
+
"longitude": 28.3983
|
32 |
+
}
|
33 |
+
]
|
34 |
+
|
35 |
+
result = collection.insert_many(sample_businesses)
|
36 |
+
print(f"Inserted {len(result.inserted_ids)} businesses.")
|