SelectAll

SelectAll( path, from )
SelectAll( path, from )
SelectAll( path, from )
SelectAll( path, from )
selectAll( path, from )
SelectAll( path, from )
SelectAll( path, from )

Description

The SelectAll function extracts one or more values from a document. It is very useful when extracting multiple values in an array. It extracts all of the values specified by the path parameter out of the from parameter and returns the values as an Array. If the path does not exist an empty array is returned.

Parameter

Argument Type Definition and Requirements

path

String

The path to the field in the document to extract

from

Object

The object containing the data to be extracted.

Returns

The value(s) specified by the path.

Examples

System.out.println(
  client.query(
    SelectAll(
      Arr(Value("favorites"), Value("name")),
        Obj(
          "favorites",  Arr(
                        Obj("name", Value("Jane")),
                        Obj("name", Value("John")),
                        Obj("name", Value("Thomas"))
                        )
        )
    )
  )
.get());
["Jane", "John", "Thomas"]

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve! documentation@fauna.com

Thank you for your feedback!