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 16000 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

[1, 2].toSet().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!