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. |
IsIndex
This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics. |
IsIndex( value )
is_index( value )
IsIndex( value )
IsIndex( value )
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 |
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: Bytes("AQIDBA=="), IsIndex: false },
{ value: [ 1, 2, 3, 4 ], IsIndex: false },
{ value: Collection("Letters"), IsIndex: false },
{ value: Ref(Credentials(), "268432497668260352"), 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-06-15T21:20:29.897Z"), IsIndex: false },
{ value: Ref(Tokens(), "1"), IsIndex: false }
]
[{'value': ['array'], 'IsIndex': False}, {'value': True, 'IsIndex': False}, {'value': False, 'IsIndex': False}, {'value': bytearray(b'\x01\x02\x03\x04'), 'IsIndex': False}, {'value': [1, 2, 3, 4], 'IsIndex': False}, {'value': Ref(id=Letters, collection=Ref(id=collections)), 'IsIndex': False}, {'value': Ref(id=282032258185953792, collection=Ref(id=credentials)), 'IsIndex': False}, {'value': Ref(id=child_db, collection=Ref(id=databases)), 'IsIndex': False}, {'value': datetime.date(2019, 11, 12), 'IsIndex': False}, {'value': Ref(id=123, collection=Ref(id=Letters, collection=Ref(id=collections))), 'IsIndex': False}, {'value': 10.1, 'IsIndex': False}, {'value': Ref(id=double, collection=Ref(id=functions)), 'IsIndex': False}, {'value': Ref(id=letters, collection=Ref(id=indexes)), 'IsIndex': True}, {'value': 10, 'IsIndex': False}, {'value': Ref(id=1, collection=Ref(id=keys)), 'IsIndex': False}, {'value': Query({'api_version': '4', 'lambda': 'x', 'expr': {'var': 'x'}}), 'IsIndex': False}, {'value': None, 'IsIndex': False}, {'value': {'x': 10}, 'IsIndex': False}, {'value': Ref(id=employees, collection=Ref(id=roles)), 'IsIndex': False}, {'value': SetRef({'match': Ref(id=letters, collection=Ref(id=indexes))}), 'IsIndex': False}, {'value': 'ten', 'IsIndex': False}, {'value': '10', 'IsIndex': False}, {'value': FaunaTime('2020-07-06T12:34:56.789Z'), 'IsIndex': False}, {'value': Ref(id=1, collection=Ref(id=tokens)), 'IsIndex': False}]
[map[IsIndex:false value:[array]] map[IsIndex:false value:true] map[IsIndex:false value:false] map[IsIndex:false value:[1 2 3 4]] map[IsIndex:false value:[1 2 3 4]] map[IsIndex:false value:{Letters 0xc0000b7e30 0xc0000b7e30 <nil>}] map[IsIndex:false value:{280481857410171392 0xc0000b7f50 0xc0000b7f50 <nil>}] map[IsIndex:false value:{child_db 0xc00015c090 0xc00015c090 <nil>}] map[IsIndex:false value:{0 63709113600 <nil>}] map[IsIndex:false value:{123 0xc000174150 0xc000174150 <nil>}] map[IsIndex:false value:10.1] map[IsIndex:false value:{double 0xc0001742a0 0xc0001742a0 <nil>}] map[IsIndex:true value:{letters 0xc0001743c0 0xc0001743c0 <nil>}] map[IsIndex:false value:10] map[IsIndex:false value:{1 0xc000174510 0xc000174510 <nil>}] map[IsIndex:false value:{[123 34 97 112 105 95 118 101 114 115 105 111 110 34 58 34 51 34 44 34 108 97 109 98 100 97 34 58 34 120 34 44 34 101 120 112 114 34 58 123 34 118 97 114 34 58 34 120 34 125 125]}] map[IsIndex:false value:{}] map[IsIndex:false value:{}] map[IsIndex:false value:map[x:10]] map[IsIndex:false value:{employees 0xc000174720 0xc000174720 <nil>}] map[IsIndex:false value:{map[match:{letters 0xc000174870 0xc000174870 <nil>}]}] map[IsIndex:false value:ten] map[IsIndex:false value:10] map[IsIndex:false value:{789000000 63729635696 <nil>}] map[IsIndex:false value:{1 0xc000174a20 0xc000174a20 <nil>}]]
Arr(ObjectV(value: Arr(StringV(array)),IsIndex: BooleanV(False)), ObjectV(value: BooleanV(True),IsIndex: BooleanV(False)), ObjectV(value: BooleanV(False),IsIndex: BooleanV(False)), ObjectV(value: BytesV(0x01, 0x02, 0x03, 0x04),IsIndex: BooleanV(False)), ObjectV(value: Arr(LongV(1), LongV(2), LongV(3), LongV(4)),IsIndex: BooleanV(False)), ObjectV(value: RefV(id = "Letters", collection = RefV(id = "collections")),IsIndex: BooleanV(False)), ObjectV(value: RefV(id = "295433010882281984", collection = RefV(id = "credentials")),IsIndex: BooleanV(False)), ObjectV(value: RefV(id = "child_db", collection = RefV(id = "databases")),IsIndex: BooleanV(False)), ObjectV(value: FaunaDate(2019-11-12 12:00:00 AM),IsIndex: BooleanV(False)), ObjectV(value: RefV(id = "123", collection = RefV(id = "Letters", collection = RefV(id = "collections"))),IsIndex: BooleanV(False)), ObjectV(value: DoubleV(10.1),IsIndex: BooleanV(False)), ObjectV(value: RefV(id = "double", collection = RefV(id = "functions")),IsIndex: BooleanV(False)), ObjectV(value: RefV(id = "letters", collection = RefV(id = "indexes")),IsIndex: BooleanV(True)), ObjectV(value: LongV(10),IsIndex: BooleanV(False)), ObjectV(value: RefV(id = "1", collection = RefV(id = "keys")),IsIndex: BooleanV(False)), ObjectV(value: QueryV(System.Collections.Generic.Dictionary`2[System.String,FaunaDB.Query.Expr]),IsIndex: BooleanV(False)), ObjectV(value: NullV,IsIndex: BooleanV(False)), ObjectV(value: ObjectV(x: LongV(10)),IsIndex: BooleanV(False)), ObjectV(value: RefV(id = "employees", collection = RefV(id = "roles")),IsIndex: BooleanV(False)), ObjectV(value: SetRefV(System.Collections.Generic.Dictionary`2[System.String,FaunaDB.Types.Value]),IsIndex: BooleanV(False)), ObjectV(value: StringV(ten),IsIndex: BooleanV(False)), ObjectV(value: StringV(10),IsIndex: BooleanV(False)), ObjectV(value: FaunaTime(2020-07-06T12:34:56.789Z),IsIndex: BooleanV(False)), ObjectV(value: RefV(id = "1", collection = RefV(id = "tokens")),IsIndex: BooleanV(False)))
[
{ 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!