Update operators for tables (HTTP)

Some Data API commands, like Update a row (HTTP), use update operators to modify rows in a table.

Set

The $set operator sets the value of the specified column to the specified value.

Example setting a non-map column:

curl -sS -L -X POST "API_ENDPOINT/v1/KEYSPACE_NAME/TABLE_NAME" \
  --header "Token: APPLICATION_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "updateOne": {
    "filter": {
      "title": "Hidden Shadows of the Past",
      "author": "John Anthony"
    },
    "update": {
      "$set": {
        "rating": 4.5,
        "genres": ["Fiction", "Drama"]
      }
    }
  }
}'

Example setting a map column:

If the updated map includes non-string keys, you must use an array of key-value pairs to update the map column.

Otherwise, you can use an array of key-value pairs or a normal map.

curl -sS -L -X POST "API_ENDPOINT/v1/KEYSPACE_NAME/TABLE_NAME" \
  --header "Token: APPLICATION_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "updateOne": {
    "filter": {
      "title": "Hidden Shadows of the Past",
      "author": "John Anthony"
    },
    "update": {
      "$set": {
        "map_column_int_str": [
            [1, "value1"],
            [2, "value2"]
        ],
        "map_column_str_str": {
          "key1": "value1",
          "key2": "value2"
        }
      }
    }
  }
}'

Unset

The $unset operator sets the specified column’s value to null or the equivalent empty form, such as [] or {} for map, list, and set types.

Unsetting a column produces a tombstone. Excessive tombstones can impact query performance.

curl -sS -L -X POST "API_ENDPOINT/v1/KEYSPACE_NAME/TABLE_NAME" \
  --header "Token: APPLICATION_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "updateOne": {
    "filter": {
      "title": "Hidden Shadows of the Past",
      "author": "John Anthony"
    },
    "update": {
        "$unset": {
            "genres": ""
        }
    }
  }
}'

Push

The $push operator appends a single element to a map, list, or set.

To append multiple items, use the $each operator with $push.

Example appending to a list or set column:

curl -sS -L -X POST "API_ENDPOINT/v1/KEYSPACE_NAME/TABLE_NAME" \
  --header "Token: APPLICATION_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "updateOne": {
    "filter": {
      "title": "Hidden Shadows of the Past",
      "author": "John Anthony"
    },
    "update": {
      "$push": {
        "genres": "SciFi",
        "topics": {
          "$each": ["robots", "AI"]
        }
      }
    }
  }
}'

Example appending to a map column:

When appending to a map, if the appended key-value pair has a non-string key, you must represent the key-value pair as an array. Otherwise, you can either use an array or a normal map.

curl -sS -L -X POST "API_ENDPOINT/v1/KEYSPACE_NAME/TABLE_NAME" \
  --header "Token: APPLICATION_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "updateOne": {
    "filter": {
      "title": "Hidden Shadows of the Past",
      "author": "John Anthony"
    },
    "update": {
        "$push": {
          "map_column_int_str": [
            1, "value1"
          ],
          "map_column_str_str": {
            "key1": "value1"
          },
          "map_column_int_str_2": {
          "$each": [
            [1, "value1"],
            [2, "value2"]
          ]
        },
          "map_column_str_str_2": {
          "$each": [
            {"key1": "value1"},
            ["key2", "value2"]
          ]
        }
      }
    }
  }
}'

Each

The $each operator modifies the $push operator to append multiple items to a map, list, or set.

Example appending to a list or set column:

curl -sS -L -X POST "API_ENDPOINT/v1/KEYSPACE_NAME/TABLE_NAME" \
  --header "Token: APPLICATION_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "updateOne": {
    "filter": {
      "title": "Hidden Shadows of the Past",
      "author": "John Anthony"
    },
    "update": {
      "$push": {
        "genres": "SciFi",
        "topics": {
          "$each": ["robots", "AI"]
        }
      }
    }
  }
}'

Example appending to a map column:

curl -sS -L -X POST "API_ENDPOINT/v1/KEYSPACE_NAME/TABLE_NAME" \
  --header "Token: APPLICATION_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "updateOne": {
    "filter": {
      "title": "Hidden Shadows of the Past",
      "author": "John Anthony"
    },
    "update": {
        "$push": {
          "map_column_int_str": [
            1, "value1"
          ],
          "map_column_str_str": {
            "key1": "value1"
          },
          "map_column_int_str_2": {
          "$each": [
            [1, "value1"],
            [2, "value2"]
          ]
        },
          "map_column_str_str_2": {
          "$each": [
            {"key1": "value1"},
            ["key2", "value2"]
          ]
        }
      }
    }
  }
}'

Pull all

The $pullAll operator removes the specified elements from a list or set, or removes entries that match the specified keys from a map.

Example removing matches from a list or set column:

curl -sS -L -X POST "API_ENDPOINT/v1/KEYSPACE_NAME/TABLE_NAME" \
  --header "Token: APPLICATION_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "updateOne": {
    "filter": {
      "title": "Hidden Shadows of the Past",
      "author": "John Anthony"
    },
    "update": {
      "$pullAll": {
        "genres": ["SciFi", "Romance"]
      }
    }
  }
}'

Example removing matches from map column:

curl -sS -L -X POST "API_ENDPOINT/v1/KEYSPACE_NAME/TABLE_NAME" \
  --header "Token: APPLICATION_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "updateOne": {
    "filter": {
      "title": "Hidden Shadows of the Past",
      "author": "John Anthony"
    },
    "update": {
      "$pullAll": {
        "metadata": ["language", "edition"]
      }
    }
  }
}'

Combine operators

You can use multiple update operators in a single update.

curl -sS -L -X POST "API_ENDPOINT/v1/KEYSPACE_NAME/TABLE_NAME" \
  --header "Token: APPLICATION_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "updateOne": {
    "filter": {
      "title": "Hidden Shadows of the Past",
      "author": "John Anthony"
    },
    "update": {
        "$set": {
          "rating": 4.5,
          "genres": ["Fiction", "Drama"]
        },
        "$unset": {
            "borrower": ""
        }
    }
  }
}'

Unsupported operators

  • $rename isn’t supported. Instead, use alterTable to add and drop columns.

  • $currentDate isn’t supported.

  • The array operators $addToSet, $pop, and $position aren’t supported.

Was this helpful?

Give Feedback

How can we improve the documentation?

© Copyright IBM Corporation 2026 | Privacy policy | Terms of use |  Manage Privacy Choices

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: Contact IBM