Pymongo keeps refusing the connection at 27017
Removing mongod.lock inside /var/lib/mongodb sudo rm /var/lib/mongodb/mongod.lock And then restarting the service should do it. For example, in my Ubuntu installation, restarting the server is something like this: sudo service mongodb start