I finally figured it out... you need to put the path to the socket replacing the slashes with %2F.
For example:
"mongo": {
"uri": "mongodb://username:password@%2Fvar%2Frun%2Fmongodb%2Fmongodb-27017.sock/dbname"
}
Thank you for your help. Hope this post helps anybody who is facing the same issue.