added code for interacting with database
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
from pymongo import MongoClient
|
||||||
|
|
||||||
|
def connect(ip_addr: str = '192.168.1.2', db_name: str = 'twitter', collection_name: str = 'tweet'):
|
||||||
|
client = MongoClient(ip_addr)
|
||||||
|
db = client[db_name]
|
||||||
|
collection = db[collection_name]
|
||||||
|
return collection
|
||||||
Reference in New Issue
Block a user