rmongodb (version 1.8.0)

mongo.set.timeout: Set the timeout value on a mongo connection

Description

Set the timeout value for network operations on a mongo connection. Subsequent network operations will timeout if they take longer than the given number of milliseconds.

Usage

mongo.set.timeout(mongo, timeout)

Arguments

mongo
(mongo) a mongo connection object.
timeout
(as.integer) number of milliseconds to which to set the timeout value.

See Also

mongo.get.timeout, mongo.create, mongo.

Examples

Run this code
mongo <- mongo.create()
if (mongo.is.connected(mongo)) {
    mongo.set.timeout(mongo, 2000L)
    timeout <- mongo.get.timeout(mongo)
    if (timeout != 2000L)
        error("expected timeout of 2000");
}

Run the code above in your browser using DataLab