Add row to tibble inside a list column with mongolite

I have a structure like this:

df <- dplyr::tibble(
  main_page = dplyr::tibble(
    viz = c("Page Views", "Device Category", "Day of Week", "Channels"),
    ids = c("a", "b", "c", "d"),
    df  = c("ga", "ga", "ga", "ga")
  ) %>% list(),
  sidebar = dplyr::tibble(
    viz = c("Bounce Rate", "Popular Posts", "Visitor Map"),
    ids = c("e", "f", "g"),
    df  = c("ga", "ga", "sc")
  ) %>% list()
) %>% replicate(2, ., simplify = FALSE) %>%
  dplyr::bind_rows() %>%
  dplyr::bind_cols(
    user_base[1:2, ] %>%
      dplyr::select(user) %>%
      dplyr::as_tibble(), .
  )

and would like to add a row to the tibble of the main_page column for a certain row. After finding the row I want to update I have tried:

connections$con_visualizations$update(
  query = '{"user": "pascal"}',
  update = paste0('{"$push":{"main_page.viz": "Bounce Rate", "main_page.ids": "g", "main_page.df": "ga"}}')
)

but without success. How would I be able to add a row to the tibble in the main_page column? Thank you

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.