contains

Full name: taxi.stdlib.contains

Signature

declare extension function <T> contains(collection: T[], searchTarget:T): Boolean

Description

Returns true if the collection contains the specified search target element.

This function checks whether a given element exists within an array or collection.

// Check if a user's roles include admin privileges
find { user: User } as {
   hasAdminAccess: user.roles.contains("ADMIN")
}

Examples

Checks whether a collection contains a specific element using type-based access.

Try it out

Schema
Query Plan
Play with this snippet by editing it here, or edit it on Taxi Playground
Result
Query failed
Next
Welcome to Taxi