rmongodb (version 1.8.0)

mongo.get.err: Retrieve an connection error code from a mongo object

Description

Retrieve an connection error code from a mongo object indicating the failure code if mongo.create() failed.

Usage

mongo.get.err(mongo)

Arguments

mongo
(mongo) a mongo connection object.

Value

(integer) error code as follows:
  • 0 No Error
  • 1 No socket - Could not create socket.
  • 2 Fail - An error occurred attempting to connect to socket
  • 3 Address fail - An error occured calling getaddrinfo().
  • 4 Not Master - Warning: connected to a non-master node (read-only).
  • 5 Bad set name - given name doesn't match the replica set.
  • 6 No Primary - Cannot find primary in replica set - connection closed.
  • 7 I/O error - An error occured reading or writing on the socket.
  • 8 Read size error - The response is not the expected length.
  • 9 Command failed - The command returned with 'ok' value of 0.
  • 10 BSON invalid - Not valid for the specified operation.
  • 11 BSON not finished - should not occur with R driver.

See Also

mongo.create, mongo

Examples

Run this code
mongo <- mongo.create()
if (!mongo.is.connected(mongo)) {
    print("Unable to connect.  Error code:")
    print(mongo.get.err(mongo))
}

Run the code above in your browser using DataLab