I use shiny dashboard sidebar and get mongolite error

I have an error "Error in mongo_collection_new: is.character(db) not TRUE" when I use siderbarMenuOutput (client side) and renderMenu (server side).

App is very big, that include mongolite.

If I use standard structure:

client:

sidebarMenu(
            menuItem('1', tabName = 'tab1'),
            menuItem('2', tabName = 'tab2'),
            menuItem('3', tabName = 'tab3'))

an error is not, but if I change it

client:

siderbarMenuOutput('menu')

server:

output$menu <- renderMenu({
    lapply(c('1','2','3'), function(x) {
        menuItem(x, tabName = paste0('item_',x)
    })
})

an error appears.

I tried this example too
Create shiny dashboard sidebar menu from dataframe

but I still get this same error

Thank you.

Upvotes: 0

Views: 66

Answers (1)

vladli
vladli

Reputation: 1573

I guess your ui changes trigger connection to mongo:

The error means you passed wrong value to mongo(collection = value) Pass an existing table name as a character and it should work fine.

mongo_connection <- mongo(
            collection = "collection_name",
            db = "dbname",
            url = "mongodb+srv://yoururlstring",
            options = ssl_options()
)

Upvotes: 0

Related Questions