how to connect mongodb primar node in replica set by mongo shell
14 views
Skip to first unread message
amazo...@gmail.com
unread,
Jun 30, 2015, 9:47:04 AM6/30/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongod...@googlegroups.com
here is javascript which will be called by mongo shell "mongo --nodb --shell test.js",I found mongo shell random connect the 1 of the 3 node,is there any way to always connect to primary node?any parameter add in followng conn str,thanks.
conn = new Mongo("replica/mongo01,mongo02,mongo03"); db = conn.getDB("db1"); do sth.....
Asya Kamsky
unread,
Jun 30, 2015, 12:37:32 PM6/30/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
You can just connect directly to the cluster when invoking the shell via: