MongoDB by default creates a unix socket in /tmp/mongodb-27017.sock . Starting with pymongo 2.4, you can establish a connection as follows:
from pymongo import MongoClient CONNECTION = MongoClient('/tmp/mongodb-27017.sock')
Alternatively, you can disable this behavior by running mongod with --nounixsocket or specify an alternative location with --unixSocketPrefix <path>
MongoDB always creates and listens for a UNIX socket if --bind_ip not installed, --bind_ip not installed, or --bind_ip indicates 127.0.0.1 .
source share