toArray()

Convert a Set to an Array.

Signature

toArray(): Array

Description

The toArray() method converts the set to an Array.

Because this method scans the full set, it returns an error if there are more than 16,000 documents in the set. This method can timeout for large sets under that limit.

The source set isn’t changed.

Parameters

None

Return value

Type Description

Array

Array representation of the set instance.

Examples

// `toSet()` converts an array to a set.
let set = [1, 2].toSet()
set.toArray()
[
  1,
  2
]

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!