Created
December 7, 2018 02:56
-
-
Save RainJayTsai/1ad279547b94d97a124cbb178435f488 to your computer and use it in GitHub Desktop.
fast_read_big_mongo_collection_doc_counts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymongo import MongoClient | |
client = MongoClient('IP') | |
db = client['DB'] | |
collection_name = 'your_full_collectaion_name' | |
resp = db.command('collstats',collection_name) | |
print(resp.get('count') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment