ifesdjeen/cascading-mongodb — pull request #1 by zonpantli (2012-10-29 13:01:49+00:00)
Title: new ctor to allow connecting with user/pass authentication

A new constructor for `MongoDBScheme` that accepts username and password to authenticate with remote Mongo. This is useful with e.g. [MongoHQ](https://www.mongohq.com) used with Heroku, which has uri such as `mongodb://heroku:password@alex.mongohq.com:port/app1234`

Usage:
```
(defn create-tap
[]
(let [scheme (MongoDBScheme. "localhost" ;; host
(java.lang.Integer. 27017) ;; port
"username"
"password"
"cascading_mongodb" ;; database
"libraries" ;; collection
"_id"
["name" "language" "votes"] ;; fields
{"_id" "?value1" ;; field mappings
"name" "?value1"
"language" "?value2"
"votes" "?value3"})
tap (MongoDBTap. scheme)]
tap))
```

It might be nice to allow passing in the whole uri as a one parameter. I didn't find a way to recover the port number from the `MongoURI` object though, so this would need either changing `getIdentifier` that uses port number as part of the string, or parsing the uri locally to extract that info.