concat()
Description
The concat()
method creates an Set by copying the calling
set to a new set and appending otherSet.
the calling set and otherSet aren’t changed.
Examples
This example concatenates two sets:
-
List the first set:
Store.all()
{ data: [ { id: "401604133304401993", coll: Store, ts: Time("2099-06-24T19:46:37.395Z"), name: "DC Fruits", address: { street: "13 Pierstorff Drive", city: "Washington", state: "DC", zipCode: "20220" } }, ... ] }
-
List the second set:
Manager.all()
{ data: [ { id: "401604133322227785", coll: Manager, ts: Time("2099-06-24T19:46:37.395Z"), firstName: "John", lastName: "Bender", email: "john.bender@example.com", address: { street: "2300 Shermer Road", city: "Shermer", state: "IL", zipCode: "60062" }, telephone: "847-576-5711" } ] }
-
Concatenate the two sets:
Store.all()!.concat(Manager.all())
{ data: [ { id: "401604133304401993", coll: Store, ts: Time("2099-06-24T19:46:37.395Z"), name: "DC Fruits", address: { street: "13 Pierstorff Drive", city: "Washington", state: "DC", zipCode: "20220" } }, ... { id: "401604133322227785", coll: Manager, ts: Time("2099-06-24T19:46:37.395Z"), firstName: "John", lastName: "Bender", email: "john.bender@example.com", address: { street: "2300 Shermer Road", city: "Shermer", state: "IL", zipCode: "60062" }, telephone: "847-576-5711" } ] }
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!