IsIndex
IsIndex( value )
Description
The IsIndex
function returns true
only if value
is an
index, otherwise it returns false
.
Parameters
Parameter | Type | Definition and Requirements |
---|---|---|
|
Any value, which is to be tested to determine whether it is an index or not. |
Examples
The following query uses Map
to iterate over an array of all of
the types of values that can be tested by a type-check function, passing
each item into a Lambda
function that returns an object, which
contains the value and the result of calling IsIndex
with that
value:
[
{ value: [ 'array' ], IsIndex: false },
{ value: true, IsIndex: false },
{ value: false, IsIndex: false },
{ value: { '0': 1, '1': 2, '2': 3, '3': 4 }, IsIndex: false },
{ value: [ 1, 2, 3, 4 ], IsIndex: false },
{ value: Collection("Letters"), IsIndex: false },
{ value: Ref(Credentials(), "302043979982045696"), IsIndex: false },
{ value: Database("child_db"), IsIndex: false },
{ value: Date("2019-11-12"), IsIndex: false },
{ value: Ref(Collection("Letters"), "123"), IsIndex: false },
{ value: 10.1, IsIndex: false },
{ value: Function("double"), IsIndex: false },
{ value: Index("letters"), IsIndex: true },
{ value: 10, IsIndex: false },
{ value: Ref(Keys(), "1"), IsIndex: false },
{ value: Query(Lambda("x", Var("x"))), IsIndex: false },
{ value: null, IsIndex: false },
{ value: { x: 10 }, IsIndex: false },
{ value: Role("employees"), IsIndex: false },
{ value: Match(Index("letters")), IsIndex: false },
{ value: 'ten', IsIndex: false },
{ value: '10', IsIndex: false },
{ value: Time("2020-07-06T12:34:56.789Z"), IsIndex: false },
{ value: Ref(Tokens(), "1"), IsIndex: false }
]
This query operates on a pre-existing schema, which is not provided here. Also, the query is executed via a client connection, that uses a secret
acquired by calling the |
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!