find(type, key, value, key, value, ...)
find(type, key, value)
find(type, map)
find(type, uuid)

This method is one of the most important and frequently used built-in functions. It returns a collection of entities, which can be empty if none of the existing nodes or relationships matches the given search parameters.

find() accepts several different parameter combinations, whereas the first parameter is always the name of the type to retrieve from the database. The second parameter can either be a UUID (string), a map (e.g. a result from nested function calls) or a list of (key, value) pairs. Calling find() with only a single parameter will return all the nodes of the given type (which might be dangerous if there are many of them in the database).

The find() method will always use exact search, if you are interested in inexact / case-insensitive search, use search().


${find('User', 'name', 'admin')}
${find('User', '7379af469cd645aebe1a3f8d52b105bd')}

results in

[7379af469cd645aebe1a3f8d52b105bd, a05c044697d648aefe3ae4589af305bd, 505d0d469cd645aebe1a3f8d52b105bd]

// This is a special case - a UUID was supplied, therefore only a single object is returned instead of a collection
About this article
Last change 2018-05-04
Topics FrontendFunctionsStructr 2.0