set.toArray()

Convert a Set to an Array.

Signature

toArray() => Array<A>

Description

Converts the calling Set to an Array.

The calling Set isn’t changed.

Eager loading

This method uses eager loading and requires a read of each document in the calling Set. For large Sets, this may result in poor performance and high costs.

Avoid use on large sets

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.

Parameters

None

Return value

Type Description

Array<Generic>

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!