在数据库中创建数据库、表,插入数据。
from pymongo import MongoClient
host = "localhost"
port = 27017 client = MongoClient(host, port)
db = client['test']
sheet = db['sheet']
for i in range(1001):
print(i)
sheet.instert_one(
{
'name': 'name'+ str(i),
'age': i,
})
在数据库中创建数据库、表,插入数据。
from pymongo import MongoClient
host = "localhost"
port = 27017 client = MongoClient(host, port)
db = client['test']
sheet = db['sheet']
for i in range(1001):
print(i)
sheet.instert_one(
{
'name': 'name'+ str(i),
'age': i,
})