diff --git a/reference/mongo/mongo/construct.xml b/reference/mongo/mongo/construct.xml index e9cbee5a9c..54946bc656 100644 --- a/reference/mongo/mongo/construct.xml +++ b/reference/mongo/mongo/construct.xml @@ -50,9 +50,15 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db be used. - An optional query string may be used to specify - read preferences for the - connection. + An optional query string may be used to specify extra options. The same + options are supported through the options array as + well, and are therefore redescribed there. + + + One part of the options governs how the driver reads from secondary nodes + in a replicaset environment. Extra information on how these read + preferences work is available as well through the read preferences documentation page. @@ -87,36 +93,43 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db If the constructor should connect before returning. Default is &true;. + + + This option is not supported through the connection string. + + - "timeout" + "db" - For how long the driver should try to connect to the database (in - milliseconds). + The database to authenticate against can be specified here, instead of + including it in the host list. This overrides a database given in the + host list. - "replicaSet" + "fireAndForget" - The name of the replica set to connect to. If this is given, the - master will be determined by using the ismaster - database command on the seeds, so the driver may end up connecting to - a server that was not even listed. See the replica set example below - for details. - - - - - "username" + This option influence how the drivers deals with potential errors + from write operations (MongoCollection::insert, + MongoCollection::update and + MongoCollection::delete). - The username can be specified here, instead of including it in the - host list. This is especially useful if a username has a ":" in it. - This overrides a username set in the host list. + When set to true (the default) the driver does + not wait until the server has acknowledged the + write. When set to false (the + recommended setting), the driver will wait + until the database has acknowledged the write. + + + If an error occurs, and fireAndForget is set to + false, then a + MongoCursorException is thrown. @@ -131,12 +144,108 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db - "db" + "readPreference" - The database to authenticate against can be specified here, instead of - including it in the host list. This overrides a database given in the - host list. + Specifies the read preference type. Read preferences provide you + with control from which secondaries data can be read from. + + + Allows values are: primary, + primaryPreferred, + secondary, secondaryPreferred + and nearest. + + + See the documentation on read + preferences for more information. + + + + + "readPreferenceTags" + + + Specifies the read preference tags. Tags can be used in combination + with the readPreference option to further control + which secondaries data might be read from. + + + See the documentation on read + preferences for more information. + + + + + "replicaSet" + + + The name of the replica set to connect to. If this is given, the + master will be automatically be determined. This means that the + driver may end up connecting to a server that was not even listed. + See the replica set example below for details. + + + + + "timeout" + + + For how long the driver should try to connect to the database (in + milliseconds). + + + + + "username" + + + The username can be specified here, instead of including it in the + host list. This is especially useful if a username has a ":" in it. + This overrides a username set in the host list. + + + + + "w" + + + The w options controls until how long the driver + blocks with regards to writing to replicaset members. + + + A positive integer value controls how many + nodes in the replicaset have received the write instruction before + the driver continues. A value of 3 would mean + that the write has been applied to the primary as well as two other + replicaset members. + + + A string value is used to control which tag sets are taken into + account for write concerns. "majority" is special + and makes sure that the write operation has been applied to the + majority (more than 50%) of the participating nodes. + + + See the core + documentation on replica sets for more information. + + + Please note that setting "w" implicitly sets + fireAndForget to false. + + + + + "wTimeout" + + + This option is used in combination with the "w" option. It controls + how many milliseconds the server waits for the write concern to be + satisfied. If it takes longer then the server signals to the driver + that it took too long and the driver will throw a + MongoCursorException exception. @@ -177,6 +286,13 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db + + 1.3.0 + Added the "fireAndForget", + "readPreference", + "readPreferenceTags", "w" and + "wTimeout" options. + 1.2.0