set.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!