collection.where()
Get the Set of matching accessible documents in the collection.
Signature
where(predicate: () => Boolean)) => Set<Collection>
where(predicate: (val: Document) => Boolean)) => Set<Collection>
Description
Gets the Set of accessible document in the collection that match the predicate function.
If where()
is the last value in a query, the first page
of the Set is returned.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
predicate |
Yes |
Anonymous function that compares values in each collection document
and returns |
Return value
Type | Description |
---|---|
Set<Document> |
Set of matching accessible documents. |
Examples
Product.where(.stock < 20)
{
data: [
{
id: "999",
coll: Product,
ts: Time("2099-07-30T21:56:38.130Z"),
name: "taco pinata",
description: "Giant Taco Pinata",
price: 2399,
stock: 10,
category: Category("123")
}
]
}
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!