Deleting documents

To delete a document, use the lcb_remove() function

static void on_removed(lcb_t instance, const void *cookie, lcb_error_t err, const lcb_remove_resp_t *resp) {
  if (err != LCB_SUCCESS) {
      fprintf(stderr, “Failed to remove item: %s\n”, lcb_strerror(instance, err));
    }
}
static void deleteDoc() {
  // ...
  lcb_set_remove_callback(instance, on_removed);
  lcb_remove_cmd_t cmd = { 0 };
  const lcb_remove_cmd_t *cmdlist = &cmd;
  cmd.v.v0.key = "deleteme";
  cmd.v.v0.nkey = strlen("deleteme");
  err = lcb_remove(instance, NULL, 1, &cmdlist);
  if (err != LCB_SUCCESS) {
    printf("Couldn't schedule remove operation: %s\n", lcb_strerror(err));
  } else {
    lcb_wait(instance);
  }
}