Skip to content

Instantly share code, notes, and snippets.

@danared
Created April 8, 2015 17:30
Show Gist options
  • Select an option

  • Save danared/f69030bd2daa0ee1fd27 to your computer and use it in GitHub Desktop.

Select an option

Save danared/f69030bd2daa0ee1fd27 to your computer and use it in GitHub Desktop.
>>> # Connect to one standalone, mongos, or replica set member.
>>> client = MongoClient(‘mongodb://server’)
>>>
>>> # Connect to a replica set.
>>> client = MongoClient(
... ‘mongodb://member1,member2/?replicaSet=my_rs’)
>>>
>>> # Load-balance among mongoses.
>>> client = MongoClient(‘mongodb://mongos1,mongos2’)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment