Skip to content

Instantly share code, notes, and snippets.

@valiantone
Created February 28, 2020 15:15
Show Gist options
  • Save valiantone/3fff51fe6727d735b5dc889af5cc5075 to your computer and use it in GitHub Desktop.
Save valiantone/3fff51fe6727d735b5dc889af5cc5075 to your computer and use it in GitHub Desktop.
import pymongo
client = pymongo.MongoClient("mongodb://valiantone:secretPassword@123.45.67.89/my_db") # defaults to port 27017
db = client.cool_db
# print the number of documents in a collection
print db.cool_collection.count()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment