1

How can I use limit/default in at pull expression in a query? Given a cardinality-many attribute, how can I control how many of its values is returned (default is max 1000 values!).

(Found it hard to figure out the correct syntax from the documentation/examples)

1 Answer 1

2

Limit (for cardinality-many attributes)

Return max 2 values of cardinality-many attribute :ns/ints:

[:find  (pull ?a [(limit :ns/ints 2)])
 :where [?a :ns/str ?b]]

Return all values of cardinality-many attribute :ns/ints:

[:find  (pull ?a [(limit :ns/ints nil)])
 :where [?a :ns/str ?b]]

Default

Return default value 2000 if attribute :ns/ints has no value:

[:find  (pull ?a [(default :ns/ints 2000)])
 :where [?a :ns/str ?b]]

Return default values 2000 and 2001 if cardinality-many attribute :ns/ints has no values:

[:find  (pull ?a [(default :ns/ints [2000 2001])])
 :where [?a :ns/str ?b]]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.