leemengtaiwan
11/6/2017 - 1:50 AM

最快連到MongoDB的code

from pymongo import MongoClient
db_setting = ["user_name","password","ip_address","db_name"]
client = MongoClient("mongodb://{}:{}@{}/{}?authMechanism=SCRAM-SHA-1".format(*db_setting))
db = client["db_name"]

db['COLLECTION_NAME'].find().count()