You've already forked Douyin_Web_Live
intro pymongo
This commit is contained in:
.DS_Store
messages
__pycache__
__init__.cpython-39.pycbase.cpython-39.pycchat.cpython-39.pycgift.cpython-39.pyclike.cpython-39.pycmember.cpython-39.pycroomuserseq.cpython-39.pycsocial.cpython-39.pycutils.cpython-39.pyc
base.pychat.pygift.pylike.pymember.pyroomuserseq.pysocial.pyutils.pyprotobuf
requirements.txtscripts/__pycache__
store
15
store/mongo.py
Normal file
15
store/mongo.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import pymongo
|
||||
|
||||
class MongoStore:
|
||||
def __init__(self):
|
||||
self.client = pymongo.MongoClient("mongodb://localhost:27017/")
|
||||
self.db = self.client['tiktok']
|
||||
|
||||
def set_collection(self, collection):
|
||||
self.collection = self.db[collection]
|
||||
|
||||
def insert_one(self, data):
|
||||
return self.collection.insert_one(data)
|
||||
|
||||
def insert_many(self, data):
|
||||
return self.collection.insert_many(data)
|
Reference in New Issue
Block a user