if __name__ == '__main__':
    client = MongoClient('localhost', 27017, maxPoolSize=50)
db = client.localhost
collection = db['chain']
cursor = collection.find({})
Get all documents of a collection using Pymongo