| DataStorageMongoDB {shiny.telemetry} | R Documentation |
Data storage class with MongoDB provider
Description
Implementation of the DataStorage R6 class to MongoDB backend using a
unified API for read/write operations
Super class
shiny.telemetry::DataStorage -> DataStorageMongoDB
Methods
Public methods
Inherited methods
Method new()
Initialize the data storage class
Usage
DataStorageMongoDB$new( hostname = "localhost", port = 27017, username = NULL, password = NULL, authdb = NULL, dbname = "shiny_telemetry", options = NULL, ssl_options = mongolite::ssl_options() )
Arguments
hostnamethe hostname or IP address of the MongoDB server.
portthe port number of the MongoDB server (default is 27017).
usernamethe username for authentication (optional).
passwordthe password for authentication (optional).
authdbthe default authentication database (optional).
dbnamename of database (default is "shiny_telemetry").
optionsAdditional connection options in a named list format (e.g., list(ssl = "true", replicaSet = "myreplicaset")) (optional).
ssl_optionsadditional connection options such as SSL keys/certs (default is
mongolite::ssl_options()).
Method clone()
The objects of this class are cloneable with this method.
Usage
DataStorageMongoDB$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## Not run:
data_storage <- DataStorageMongoDB$new(
host = "localhost",
db = "test",
ssl_options = mongolite::ssl_options()
)
data_storage$insert("example", "test_event", "session1")
data_storage$insert("example", "input", "s1", list(id = "id1"))
data_storage$insert("example", "input", "s1", list(id = "id2", value = 32))
data_storage$insert(
"example", "test_event_3_days_ago", "session1",
time = lubridate::as_datetime(lubridate::today() - 3)
)
data_storage$read_event_data()
data_storage$read_event_data(Sys.Date() - 1, Sys.Date() + 1)
data_storage$close()
## End(Not run)