R/mg_rm_column.R

Defines functions mg_rm_column

Documented in mg_rm_column

#' Remove a column from a mongo DB table (collection).
#'
#' @name mg_rm_column
#'
#' @param table name as a character
#' @param name of the column as a character
#'
#' @return logical
mg_rm_column <- function(table, name) {
  stopifnot(name %in% (mg_col_names(table)))

  mongolite::mongo(table)$update('{}', paste0('{"$unset":{"', name, '": true}}'), multiple = TRUE)
}
Cronbach-GmbH/mgdbs documentation built on Dec. 17, 2021, 3:08 p.m.