Hello,
I've tried searching the posts in this forum and didn't find this, so I hope it's not a duplicate.
I'm trying to connect to a mongodb server using pymongo, running code through Jupyter Notebooks. I am able to connect successfully with Tableau, so I'm confident that I have correct server, port, username, and password information. However, when I attempt the following, I get an error: (obviously, USERNAME, PASSWORD, SERVER, PORT, and DB are all placeholders for the purpose of posting publicly. 'user' is the name of the collection for which I'm attempting to count records as a test to see if I can successfully connect)
from pymongo import MongoClient
import urllib
mongo_uri = "mongodb://USERNAME:" + urllib.parse.quote_plus("PASSWORD") + "@SERVER:PORT/DB"
conn = MongoClient(mongo_uri)
db = conn.DB
collection = db['user']
collection.count()
The error traceback ends with: ServerSelectionTimeoutError: Got opcode 1735290733 but expected 1
My searching around for what to make of this error has proved unhelpful.
Version info:
>> python -c "import sys; print(sys.version)"
3.5.1 |Anaconda 4.0.0 (64-bit)| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit (AMD64)]
>> python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"
3.6.0.dev0
False
Thanks in advance for any help!!
Best,
Scott