intro pymongo

This commit is contained in:
耿伦伦
2021-11-29 18:27:02 +08:00
parent 3fc3035cdf
commit 3f608c3510
30 changed files with 37974 additions and 95 deletions

0
store/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

15
store/mongo.py Normal file
View 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)