26 lines
703 B
Python
26 lines
703 B
Python
import pymongo
|
|
|
|
myclient = pymongo.MongoClient("mongodb://root:example@localhost:27017/")
|
|
|
|
mydb = myclient["mydatabase"]
|
|
mycol = mydb["customers"]
|
|
|
|
mydict = {"text":"ahoj svet"}
|
|
|
|
x = mycol.insert_one(mydict)
|
|
|
|
def createdb():
|
|
myclient = pymongo.MongoClient(CONNECTION)
|
|
db=myclient[DBNAME]
|
|
linkcol = db["links"]
|
|
linkcol.create_index("url",unique=True)
|
|
linkcol.create_index("host")
|
|
contentcol = db["content"]
|
|
contentcol.create_index("url",unique=True)
|
|
#contentcol.create_index({"paragraph_checksums":1})
|
|
contentcol.create_index("host")
|
|
htmlcol = db["html"]
|
|
htmlcol.create_index("url")
|
|
domaincol = db["domains"]
|
|
domaincol.create_index("host",unique=True)
|