Indexes
Indexes( [database] )
Indexes( [database] )
Indexes( [database] )
Indexes( [database] )
indexes( [database] )
Indexes( [database] )
Description
Parameters
Argument | Type | Definition and Requirements |
---|---|---|
|
Optional - A reference to a child database. If not specified, the current database is used. |
Returns
A Set reference for the available indexes in the
specified child database
(or the current database if database
is not
specified).
Examples
The following query gets the references to all indexes in the current database:
client.Query(
Paginate(Indexes())
);
ObjectV(data: Arr(RefV(id = "spells_by_element", collection = RefV(id = "indexes")), RefV(id = "spellbooks_by_owner", collection = RefV(id = "indexes")), RefV(id = "spells_by_spellbook", collection = RefV(id = "indexes")), RefV(id = "spells_by_element_and_name", collection = RefV(id = "indexes")), RefV(id = "elements_of_spells", collection = RefV(id = "indexes")), RefV(id = "letters", collection = RefV(id = "indexes")), RefV(id = "people_by_age_first", collection = RefV(id = "indexes")), RefV(id = "people_by_last_first", collection = RefV(id = "indexes")), RefV(id = "users_by_email", collection = RefV(id = "indexes"))))
result, err := client.Query(
f.Paginate(f.Indexes()))
if err != nil {
fmt.Fprintln(os.Stderr, err)
} else {
fmt.Println(result)
}
map[data:[{spells_by_element 0xc00008e240 0xc00008e240 <nil>} {spellbooks_by_owner 0xc00008e330 0xc00008e330 <nil>} {spells_by_spellbook 0xc00008e420 0xc00008e420 <nil>} {spells_by_element_and_name 0xc00008e510 0xc00008e510 <nil>} {elements_of_spells 0xc00008e600 0xc00008e600 <nil>} {letters 0xc00008e6f0 0xc00008e6f0 <nil>} {people_by_age_first 0xc0000bf1d0 0xc0000bf1d0 <nil>} {people_by_last_first 0xc0000bf2c0 0xc0000bf2c0 <nil>} {users_by_email 0xc0000bf3b0 0xc0000bf3b0 <nil>}]]
System.out.println(
client.query(
Paginate(Indexes())
).get());
{data: [ref(id = "spells_by_element", collection = ref(id = "indexes")), ref(id = "spellbooks_by_owner", collection = ref(id = "indexes")), ref(id = "spells_by_spellbook", collection = ref(id = "indexes")), ref(id = "spells_by_element_and_name", collection = ref(id = "indexes")), ref(id = "elements_of_spells", collection = ref(id = "indexes")), ref(id = "letters", collection = ref(id = "indexes")), ref(id = "people_by_age_first", collection = ref(id = "indexes")), ref(id = "people_by_last_first", collection = ref(id = "indexes")), ref(id = "users_by_email", collection = ref(id = "indexes"))]}
client.query(
q.Paginate(q.Indexes())
)
.then((ret) => console.log(ret))
.catch((err) => console.error('Error: %s', err))
{
data: [
Index("spells_by_element"),
Index("spellbooks_by_owner"),
Index("spells_by_spellbook"),
Index("spells_by_element_and_name"),
Index("elements_of_spells"),
Index("letters"),
Index("people_by_age_first"),
Index("people_by_last_first"),
Index("users_by_email")
]
}
result = client.query(
q.paginate(q.indexes())
)
print(result)
{'data': [Ref(id=spells_by_element, collection=Ref(id=indexes)), Ref(id=spellbooks_by_owner, collection=Ref(id=indexes)), Ref(id=spells_by_spellbook, collection=Ref(id=indexes)), Ref(id=spells_by_element_and_name, collection=Ref(id=indexes)), Ref(id=elements_of_spells, collection=Ref(id=indexes)), Ref(id=letters, collection=Ref(id=indexes)), Ref(id=people_by_age_first, collection=Ref(id=indexes)), Ref(id=people_by_last_first, collection=Ref(id=indexes)), Ref(id=users_by_email, collection=Ref(id=indexes))]}
client.query(Paginate(Indexes()))
{data: [ref(id = "spells_by_element", collection = ref(id = "indexes")), ref(id = "spellbooks_by_owner", collection = ref(id = "indexes")), ref(id = "spells_by_spellbook", collection = ref(id = "indexes")), ref(id = "spells_by_element_and_name", collection = ref(id = "indexes")), ref(id = "elements_of_spells", collection = ref(id = "indexes")), ref(id = "letters", collection = ref(id = "indexes")), ref(id = "people_by_age_first", collection = ref(id = "indexes")), ref(id = "people_by_last_first", collection = ref(id = "indexes")), ref(id = "users_by_email", collection = ref(id = "indexes"))]}
The following query demonstrates what happens when no indexes exist:
Value result = await client.Query(
Paginate(Indexes())
);
ObjectV(data: Arr())
result, err := client.Query(
f.Paginate(f.Indexes()))
if err != nil {
fmt.Fprintln(os.Stderr, err)
} else {
fmt.Println(result)
}
map[data:[]]
System.out.println(
client.query(
Paginate(Indexes())
).get());
{data: []}
client.query(
q.Paginate(q.Indexes())
)
.then((ret) => console.log(ret))
.catch((err) => console.error('Error: %s', err))
{ data: [] }
result = client.query(
q.paginate(q.indexes())
)
print(result)
{'data': []}
println(Await.result(
client.query(
Paginate(Indexes())
),
5.seconds
))
{data: []}
Was this article helpful?
We're sorry to hear that.
Tell us how we can improve!
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!