Redix LogoDocumentation
API ReferenceJSON

JSONNumIncrBy

Increment a numeric value in a JSON document

Syntax

Redix.JSONNumIncrBy(key, path, increment, callback)

Parameters

Prop

Type

Returns

  • string: The new value as a string

Examples

-- Increment level
Redix.JSONNumIncrBy('character:123', '$.level', 1, function(err, newLevel)
    print('New level:', newLevel)
end)

-- Decrement health
Redix.JSONNumIncrBy('character:123', '$.stats.health', -10)

-- Add money
Redix.JSONNumIncrBy('character:123', '$.wallet', 500)