2017-04-03 43 views
0

我最近在mac sierra上使用自制軟件安裝了mongodb,並且一切正常;從導入到連接。但是當我試圖插入我得到了以下錯誤:pymongo在mac sierra插入錯誤

Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/Library/Python/2.7/site-packages/pymongo/collection.py", line 2467, in insert 
    with self._socket_for_writes() as sock_info: 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__ 
    return self.gen.next() 
    File "/Library/Python/2.7/site-packages/pymongo/mongo_client.py", line 823, in _get_socket 
    server = self._get_topology().select_server(selector) 
    File "/Library/Python/2.7/site-packages/pymongo/topology.py", line 214, in select_server 
    address)) 
    File "/Library/Python/2.7/site-packages/pymongo/topology.py", line 189, in select_servers 
    self._error_message(selector)) 
pymongo.errors.ServerSelectionTimeoutError: localhost:27017: timed out 

我用pymongo 3.4.3,然後我降級到2.8,然後我去下面的連接時:

Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/Library/Python/2.7/site-packages/pymongo/mongo_client.py", line 377, in __init__ 
    raise ConnectionFailure(str(e)) pymongo.errors.ConnectionFailure: timed out 
+0

是否使用IPv6的本機連接? – lapinkoira

+0

不,我正在使用ipv4 localhost連接 – Golfexodus

回答

0

謝謝你們,我明白了,我意識到我的mongod實際上並不是從終端開始的。

我所要做的就是從終端開始的mongod像這樣:

$ mongod的