Is there any way to connect to mongodb via unix socket in python, while the official pymongo module does not support unix socket yet.
I'd like any third-party alternatives, or patches, while I've searched around and did not find one.
I do not like an ORM-style library since the mongodb => python dicts are natural and easy to use, so I did not take something like MongoEngine into account.
Tyler Brock :
MongoDB, by default, creates a unix socket at /tmp/mongodb-27017.sock. As of pymongo 2.4 you can make a connection like this:\n\nfrom pymongo import MongoClient\nCONNECTION = MongoClient('/tmp/mongodb-27017.sock')\n\n\nAdditionally you can disable this behavior by starting mongod with --nounixsocket or specify an alternate location with --unixSocketPrefix <path>\n\nMongoDB will always create and listen on a UNIX socket, unless --nounixsocket is set, --bind_ip is not set, or --bind_ip specifies 127.0.0.1.",
2013-05-22T07:18:00
Shane Davies :
Update for MongoDB v3.x\n\nIf you upgrade to MongoDB 3.x on linux, the group and other permissions on /tmp/mongodb-27017.sock have been removed. You will receive permission denied error's when you connect using MongoClient(host='/tmp/mongodb-27017.sock')\n\nTo fix this, upgrade your MongoDB configuration file to YAML format, which includes the filePermissions option so you set the permissions back.\n\nExample /etc/mongod.conf in YAML format:\n\nstorage:\n dbPath: \"/var/lib/mongodb\"\nsystemLog:\n destination: file\n path: \"/var/log/mongodb/mongod.log\"\n logAppend: true\nnet:\n unixDomainSocket:\n filePermissions: 0777\n",
2015-06-05T02:24:04