mongolite
mongolite copied to clipboard
unable to connect with shiny-server
My shiny app works good with shinyapps.io.
But something wrong with shiny-server.
The details are, I installed ubuntu 20.04 on vmware, installed shiny-server on it, and the VM is using a network that is in bridged network.
I'm getting an error.
No suitable servers found (`serverSelectionTryOnce` set): [connection closed calling hello on `ac-6yidp0p-shard-00-00.edwdcrv.mongodb.net:27017'] [connection closed calling hello on `ac-6yidp0p-shard-00-01.edwdcrv.mongodb.net:27017'] [connection closed calling hello on `ac-6yidp0p-shard-00-02.edwdcrv.mongodb.net:27017']
options(mongodb = list(
"username" = "user",
"password" = "passwd",
"host" = "123.456.mongodb.net"
))
url <- sprintf(
"mongodb+srv://%s:%s@%s/",
options()$mongodb$username,
options()$mongodb$password,
options()$mongodb$host
)
db <- "mydb"
find_coll <- function(collection) {
conn <- mongo(collection = collection, db = db, url = url, options = ssl_options(weak_cert_validation = TRUE))
data <- conn$find()
data
}