Increments the value of a numeric field by the amount of the specified value.

Operations Performed

  1. Verifies that a field at the specified path exists in the document with the specified ID. If the field at the specified path does not exist, this operation creates it with the specified value.
  2. Verifies that the field is of the same numeric data type as the passed value.
  3. Adds the passed value to the existing value.


public void incrementField(String tablePath, String _id, String fieldPath, short inc) {
    try(Table table = MapRDB.getTable(tablePath)) {
      table.increment(_id, fieldPath, inc);
Parameter Description
_id The value of the document's _id field.
fieldPath The path of the field in dotted notation. See Dotted Notation for Identifying Fields.
inc The short value.
tablePath The path of the table in the MapR file system. See the "Table Paths" section in MapR-DB JSON Tables.

Permissions Required

Link to Javadoc