Skip to main content Skip to complementary content

arrayIndexOf

Returns the index of a value inside an array.

The index is zero based, and if a value is not present in the array, it results in -1.

Arguments

  1. Array to use.
  2. Value to use.

Examples

Expression Result
WITH $names = [ 'John Doe', 'Tom Cruise', 'David Bowie',null] SELECT { a = arrayIndexOf($names, 'Tom Cruise'), b = arrayIndexOf($names, null), c = arrayIndexOf($names, 'David Bowie') } {"a": 1, "b": 3, "c": 2}

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!