We've got a strange gotcha (it maybe a bug with the mongo driver and we will raise an appropriate bug with them), but I think this is worth noting here.....
We were connecting to a replica set, but always getting "couldn't determine master" being returned. Connecting to individual notes without replicaset being set worked fine (directly to the master, or slave okay for reads). Replicaset working fine, and all setup okay.
The issue was our network setup, despite being able to resolve dbname-X.domain.com the server names were returning as dbname-X without the domain.
Pinging dbname-X worked, but for some reason the driver isn't resolving it. Adding the entry to hosts fixed this though.