I'm trying to count a distinct value with pymongo, my code looks like :
account_log = mongo["account_log"].find({"uuid": guid}).distinct("logged_number")
total["account"] = len(mongo["group_member"].find({ "group_id": {"$in": groups}}).distinct("phone"))
the distinct inside len() was very very slow, is there another way to count the distinct result, thank you