You should just connect to the primary (master) directly.
If you want to run queries on secondaries (not-master) then you must
set slaveOk.
> db.getMongo().setSlaveOk()
You can also get help:
> help
> rs.help()
> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>
>
You can write a script to get the master fairly easily. That is what
the drivers do:
http://www.mongodb.org/display/DOCS/Replica+Set+Commands#ReplicaSetCommands-Commands
Just write a shell script that does that call from a seed server/list
and starts mongo with the primary host.
You could also ask for a feature in the shell for this...
http://jira.mongodb.org/
>> If you want to run queries on secondaries (not-master) then you must
>> set slaveOk.
>>
>> > db.getMongo().setSlaveOk()
>
> Yeah, that's probably a good solution for most of my use cases.
>
> Thanks!
> Andy
>