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)
db | set database from parameter. |
---|
mongolite::mongo valid URI
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
{ host = Sys.getenv("MONGODB_HOST") Sys.setenv(MONGODB_HOST="localhost") gc_setup() Sys.setenv(MONGODB_HOST=host) }