Skip to content

Instantly share code, notes, and snippets.

@gistfrojd
Created December 11, 2014 09:58
Show Gist options
  • Save gistfrojd/7fba207ab44272741ac0 to your computer and use it in GitHub Desktop.
Save gistfrojd/7fba207ab44272741ac0 to your computer and use it in GitHub Desktop.
How to handle separate read and write servers in mongoose
var uri = "mongodb://write.server.com/mydatabase,read.server.com/mydatabase?replicaSet=rs-test&readPreference=nearest";
connection = mongoose.connection;
mongoose.connect(uri, {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment