Set an R environment variable with database details. This is done so that username and password of the database is kept away from your code base deliberaltey.

gc_setup(db)

Arguments

db

set database from parameter.

Value

mongolite::mongo valid URI

Details

The functions checks and gives feedback on a valid URL to be used with mongolite::mongo's url parameter. To do this it needs:

  • MONGODB_HOST

  • MONGODB_PORT

  • MONGODB_USER

  • MONGODB_PASS

  • (optional) MONGODB_DB

  • (optional) MONGODB_COLL - for default connection

Examples

{ host = Sys.getenv("MONGODB_HOST") Sys.setenv(MONGODB_HOST="localhost") gc_setup() Sys.setenv(MONGODB_HOST=host) }