Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MONGODB | Address family not supported by protocol family - connect(2) for [::1]:27017

I'm using rails 5 and lastest mongoid gem, and when running mongodb server with any Model will throw this error:

MONGODB | Address family not supported by protocol family - connect(2) for [::1]:27017

I almost searched everything but I can't find any solution.

Any suggestions are much appreciated.

like image 279
Ron Dam Avatar asked Jan 25 '18 04:01

Ron Dam


1 Answers

Just ran into this myself when upgrading the mongo gem to 2.5.0 (from 2.4.3). It looks like you can no longer connect to a Mongo instance using a domain name, in my case (and probably your's) localhost.

Change your MONGOID_HOST from localhost:27017 to 127.0.0.1:27017.

like image 70
Benjamin Dobell Avatar answered Sep 20 '22 15:09

Benjamin Dobell