我想编写一个函数来返回 mongodb 中 mycollection
中包含的所有文档
from pymongo import MongoClient
if __name__ == '__main__':
client = MongoClient("localhost", 27017, maxPoolSize=50)
db=client.mydatabase
collection=db['mycollection']
cursor = collection.find({})
for document in cursor:
print(document)
但是,该函数返回: Process finished with exit code 0