LearnBoost/mongoose — pull request #737 by KarneAsada (2012-02-17 06:00:30+00:00)
Title: Adding username/password to connect options

I wanted to use mongoose with a password protected mongodb without passing the full URI to mongoose.connect(). I made an addition that parses the user/pass from the host parameter, when a string like "user:pass@the.domain.com" is used.

I also added user and pass properties to the options parameter:

mongoose.connect("host", "database", port, {user:"user", pass:"pass"})

This allowed me to decouple the parts of the mongodb URL, so that I could setup different ports and users for different environments (dev, staging, prod, etc).