Union
Union( group, ... )
Union( group, ... )
Union( group, ... )
Union( group, ... )
union( group, ... )
Union( group, ... )
Examples
The following query combines the Set Reference returned by
locating the search term "fire" in the index named "spells_by_element"
and the Set Reference returned by locating the search term
"water" in the index named "spells_by_element". The Paginate
function materialized the results of the Union
operation into a
Page.
ObjectV(data: Arr(RefV(id = "181388642046968320", collection = RefV(id = "spells", collection = RefV(id = "collections"))), RefV(id = "181388642071085568", collection = RefV(id = "spells", collection = RefV(id = "collections"))), RefV(id = "181388642088911360", collection = RefV(id = "spells", collection = RefV(id = "collections")))))
map[data:[{181388642046968320 0xc000164180 0xc000164180 <nil>} {181388642071085568 0xc000164330 0xc000164330 <nil>} {181388642088911360 0xc0001644e0 0xc0001644e0 <nil>}]]
{data: [ref(id = "181388642046968320", collection = ref(id = "spells", collection = ref(id = "collections"))), ref(id = "181388642071085568", collection = ref(id = "spells", collection = ref(id = "collections"))), ref(id = "181388642088911360", collection = ref(id = "spells", collection = ref(id = "collections")))]}
{
data: [
Ref(Collection("spells"), "181388642046968320"),
Ref(Collection("spells"), "181388642071085568"),
Ref(Collection("spells"), "181388642088911360")
]
}
{'data': [Ref(id=181388642046968320, collection=Ref(id=spells, collection=Ref(id=collections))), Ref(id=181388642071085568, collection=Ref(id=spells, collection=Ref(id=collections))), Ref(id=181388642088911360, collection=Ref(id=spells, collection=Ref(id=collections)))]}
{
data: [
Ref(Collection("spells"), "181388642046968320"),
Ref(Collection("spells"), "181388642071085568"),
Ref(Collection("spells"), "181388642088911360")
]
}
The following query is similar to the example above, but it returns document events instead of the index tuples.
ObjectV(data: Arr(ObjectV(ts: LongV(1603756842880000),action: StringV(add),document: RefV(id = "181388642046968320", collection = RefV(id = "spells", collection = RefV(id = "collections")))), ObjectV(ts: LongV(1603756842880000),action: StringV(add),document: RefV(id = "181388642071085568", collection = RefV(id = "spells", collection = RefV(id = "collections")))), ObjectV(ts: LongV(1603756842880000),action: StringV(add),document: RefV(id = "181388642088911360", collection = RefV(id = "spells", collection = RefV(id = "collections"))))))
map[data:[map[action:add document:{181388642046968320 0xc000144270 0xc000144270 <nil>} ts:1603747307070000] map[action:add document:{181388642071085568 0xc000144450 0xc000144450 <nil>} ts:1603747307070000] map[action:add document:{181388642088911360 0xc00008e210 0xc00008e210 <nil>} ts:1603747307070000]]]
{data: [{ts: 1594337952410000, action: "add", document: ref(id = "181388642046968320", collection = ref(id = "spells", collection = ref(id = "collections")))}, {ts: 1594337952410000, action: "add", document: ref(id = "181388642071085568", collection = ref(id = "spells", collection = ref(id = "collections")))}, {ts: 1594337952410000, action: "add", document: ref(id = "181388642088911360", collection = ref(id = "spells", collection = ref(id = "collections")))}]}
{
data: [
{
ts: 1592112265440000,
action: 'add',
document: Ref(Collection("spells"), "181388642046968320")
},
{
ts: 1592112265440000,
action: 'add',
document: Ref(Collection("spells"), "181388642071085568")
},
{
ts: 1592112265440000,
action: 'add',
document: Ref(Collection("spells"), "181388642088911360")
}
]
}
{'data': [{'ts': 1592870395870000, 'action': 'add', 'document': Ref(id=181388642046968320, collection=Ref(id=spells, collection=Ref(id=collections)))}, {'ts': 1592870395870000, 'action': 'add', 'document': Ref(id=181388642071085568, collection=Ref(id=spells, collection=Ref(id=collections)))}, {'ts': 1592870395870000, 'action': 'add', 'document': Ref(id=181388642088911360, collection=Ref(id=spells, collection=Ref(id=collections)))}]}
{
data: [
{
ts: 1624310551550000,
action: 'add',
document: Ref(Collection("spells"), "181388642046968320")
},
{
ts: 1624310551550000,
action: 'add',
document: Ref(Collection("spells"), "181388642071085568")
},
{
ts: 1624310551550000,
action: 'add',
document: Ref(Collection("spells"), "181388642088911360")
}
]
}
The following query demonstrates how various arrays are evaluated:
Arr(Arr(StringV(A), StringV(B), StringV(C), StringV(D)), Arr(StringV(A), StringV(B), StringV(C)), Arr(StringV(A), StringV(B), StringV(C), StringV(D)), Arr(StringV(A), StringV(B), StringV(B), StringV(C)))
[[A B C D] [A B C] [A B C D] [A B B C]]
[["A", "B", "C", "D"], ["A", "B", "C"], ["A", "B", "C", "D"], ["A", "B", "B", "C"]]
[ [ 'A', 'B', 'C', 'D' ],
[ 'A', 'B', 'C' ],
[ 'A', 'B', 'C', 'D' ],
[ 'A', 'B', 'B', 'C' ] ]
[['A', 'B', 'C', 'D'], ['A', 'B', 'C'], ['A', 'B', 'C', 'D'], ['A', 'B', 'B', 'C']]
[
[ 'A', 'B', 'C', 'D' ],
[ 'A', 'B', 'C' ],
[ 'A', 'B', 'C', 'D' ],
[ 'A', 'B', 'B', 'C' ]
]
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!