Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface JsonModuleCommands<Context>

Redis JSON module.

Type parameters

  • Context: ClientContext

Hierarchy

  • JsonModuleCommands

Methods

json_arrappend

  • json_arrappend(key: string, path: string, json: unknown, ...jsons: unknown[]): Result<number, Context>
  • Parameters

    • key: string

      Key.

    • path: string

      JSON path.

    • json: unknown

      JSON value.

    • Rest ...jsons: unknown[]

      Other JSON values.

    Returns Result<number, Context>

    The array's new size.

json_arrindex

  • json_arrindex(key: string, path: string, jsonScalar: string | number | boolean, start?: number, stop?: number): Result<number, Context>
  • Parameters

    • key: string

      Key.

    • path: string

      JSON path.

    • jsonScalar: string | number | boolean

      JSON scalar.

    • Optional start: number

      Start index.

    • Optional stop: number

      Stop index.

    Returns Result<number, Context>

    The position of the scalar value in the array, or -1 if unfound.

json_arrinsert

  • json_arrinsert(key: string, path: string, index: number, json: unknown, ...jsons: unknown[]): Result<number, Context>
  • Parameters

    • key: string

      Key.

    • path: string

      JSON path.

    • index: number

      Array index.

    • json: unknown

      JSON value.

    • Rest ...jsons: unknown[]

      Other JSON values.

    Returns Result<number, Context>

    The array's new length.

json_arrlen

  • json_arrlen(key: string, path?: string): Result<null | number, Context>
  • Parameters

    • key: string

      Key.

    • Optional path: string

      JSON path.

    Returns Result<null | number, Context>

    The array length.

json_arrpop

  • json_arrpop(key: string, path?: string, index?: number): Result<null | string, Context>
  • Parameters

    • key: string

      Key.

    • Optional path: string

      JSON path.

    • Optional index: number

      Array index.

    Returns Result<null | string, Context>

    The popped JSON value.

json_arrtrim

  • json_arrtrim(key: string, path: string, start: number, stop: number): Result<number, Context>
  • Parameters

    • key: string

      Key.

    • path: string

      JSON path.

    • start: number

      Start index.

    • stop: number

      Stop index.

    Returns Result<number, Context>

    The array new length.

json_debug

  • json_debug(subcommand: "MEMORY", key: string, path?: string): Result<number, Context>
  • json_debug(subcommand: "HELP"): Result<string[], Context>
  • Parameters

    • subcommand: "MEMORY"

      Subcommand.

    • key: string

      Key.

    • Optional path: string

      JSON path.

    Returns Result<number, Context>

    The size in bytes of the value

  • Parameters

    • subcommand: "HELP"

      Subcommand.

    Returns Result<string[], Context>

    Array with the help message.

json_del

  • json_del(key: string, path?: string): Result<0 | "1", Context>
  • Parameters

    • key: string

      Key under which JSON value is stored.

    • Optional path: string

      Path in the JSON object.
      Defaults to root if not provided.

    Returns Result<0 | "1", Context>

    The number of paths deleted (0 or 1).

json_get

  • json_get(key: string, ...args: string[]): Result<unknown, Context>
  • Syntax

    JSON.GET 
                [INDENT indentation-string]
                [NEWLINE line-break-string]
                [SPACE space-string]
                [NOESCAPE]
                [path ...]
    

    Description

    Return the value at path in JSON serialized form.

    This command accepts multiple path s, and defaults to the value's root when none are given.

    The following subcommands change the reply's format and are all set to the empty string by default: - INDENT sets the indentation string for nested levels

    • NEWLINE sets the string that's printed at the end of each line
    • SPACE sets the string that's put between a key and a value

    The NOESCAPE option will disable the sending of \uXXXX escapes for non-ascii characters. This option should be used for efficiency if you deal mainly with such text. The escaping of JSON strings will be deprecated in the future and this option will become the implicit default.

    Parameters

    • key: string

      Key under which JSON value is stored.

    • Rest ...args: string[]

      Command arguments.

    Returns Result<unknown, Context>

    The reply's structure depends on the number of paths.
    A single path results in the value itself being returned, whereas multiple paths are returned as a JSON object in which each path is a key.

json_mget

  • json_mget(key: string, ...args: string[]): Result<unknown[], Context>
  • Syntax

    JSON.MGET  [key ...] 
    

    Description

    Returns the values at path from multiple key s. Non-existing keys and non-existing paths are reported as null.

    Parameters

    • key: string

      Key under which JSON value is stored.

    • Rest ...args: string[]

      Command arguments.

    Returns Result<unknown[], Context>

    The JSON serialization of the value at each key's path.

json_numincrby

  • json_numincrby(key: string, path: string, number: number): Result<string, Context>
  • Parameters

    • key: string

      Key.

    • path: string

      JSON path.

    • number: number

      Increment number.

    Returns Result<string, Context>

    The stringified new value.

json_nummultby

  • json_nummultby(key: string, path: string, number: number): Result<string, Context>
  • Parameters

    • key: string

      Key.

    • path: string

      JSON path.

    • number: number

      Multiply number.

    Returns Result<string, Context>

    The stringified new value.

json_objkeys

  • json_objkeys(key: string, path?: string): Result<null | string[], Context>
  • Parameters

    • key: string

      Key.

    • Optional path: string

      JSON path.

    Returns Result<null | string[], Context>

    Object keys.

json_objlen

  • json_objlen(key: string, path?: string): Result<null | number, Context>
  • Parameters

    • key: string

      Key.

    • Optional path: string

      JSON path.

    Returns Result<null | number, Context>

    The number of keys in the object.

json_resp

  • json_resp(key: string, path?: string): Result<unknown[], Context>
  • Parameters

    • key: string

      Key.

    • Optional path: string

      JSON path.

    Returns Result<unknown[], Context>

    The JSON's RESP form.

json_set

  • json_set(key: string, path: string, json: string | Buffer, ...args: ("NX" | "XX")[]): Result<null | "OK", Context>
  • Syntax

    JSON.SET    [NX | XX]
    

    Description

    Can be found here.

    Parameters

    • key: string

      Key.

    • path: string

      JSON path.

    • json: string | Buffer

      Serialized JSON string.

    • Rest ...args: ("NX" | "XX")[]

      Command arguments.

    Returns Result<null | "OK", Context>

    'OK' if executed correctly, or null if the specified NX or XX conditions were not met.

json_strappend

  • json_strappend(key: string, path: string, jsonString: string): Result<number, Context>
  • Parameters

    • key: string

      Key.

    • path: string

      JSON path.

    • jsonString: string

      JSON string.

    Returns Result<number, Context>

    The string's new length.

json_strlen

  • json_strlen(key: string, path?: string): Result<null | number, Context>
  • Parameters

    • key: string

      Key.

    • Optional path: string

      JSON path.

    Returns Result<null | number, Context>

    The string's length.

json_type

  • json_type(key: string, path?: string): Result<null | string, Context>
  • Parameters

    • key: string

      Key.

    • Optional path: string

      JSON path.

    Returns Result<null | string, Context>

    The type of value at path.