FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date. For more details, review the migration guide. Contact support@fauna.com with any questions. |
Intersection
This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics. |
Intersection( group, ... )
intersection( group, ... )
Intersection( group, ... )
Intersection( group, ... )
Intersection( group, ... )
Description
The Intersection
function compares all of the items in each group
,
which can be an Array or Set Reference, and returns the
elements that appear in every provided group
.
The run time of For query timeout errors, you may specify a larger query timeout via the driver that you are using. |
Parameters
Parameter | Type | Definition and Requirements |
---|---|---|
|
Array or Set Reference |
One or more arrays or Set References to be intersected. All
provided |
Returns
When group
is an Array, an array of the items that appear in
every provided group
.
When group
is a Set Reference, a Set Reference of the
items that appear in every provided group.
Examples
The following query intersects the Set Reference
returned by locating the search term "fire" in the index named
"spells_by_element" with the Set Reference returned by locating
the search term "water" in the Index named "spells_by_element". The
Paginate
function executes the Set Reference and returns
the results of the Intersect
operation in a Page.
{ data: [ Ref(Collection("spells"), "181388642071085568") ] }
{'data': [Ref(id=181388642071085568, collection=Ref(id=spells, collection=Ref(id=collections)))]}
map[data:[{181388642071085568 0xc0001421e0 0xc0001421e0 <nil>}]]
ObjectV(data: Arr(RefV(id = "181388642071085568", collection = RefV(id = "spells", collection = RefV(id = "collections")))))
{ data: [ Ref(Collection("spells"), "181388642071085568") ] }
The following query demonstrates how various arrays are evaluated:
[ [], [ 'B' ], [ 'B', 'C' ], [ 'B' ] ]
[[], ['B'], ['B', 'C'], ['B']]
[[] [B] [B C] [B]]
Arr(Arr(), Arr(StringV(B)), Arr(StringV(B), StringV(C)), Arr(StringV(B)))
[ [], [ 'B' ], [ 'B', 'C' ], [ 'B' ] ]
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!