You've already forked Douyin_Web_Live
intro pymongo
This commit is contained in:
0
store/__init__.py
Normal file
0
store/__init__.py
Normal file
BIN
store/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
store/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
BIN
store/__pycache__/mongo.cpython-39.pyc
Normal file
BIN
store/__pycache__/mongo.cpython-39.pyc
Normal file
Binary file not shown.
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