



















// Create your own objects
// https://groq.dev/lcGV0Km6dpvYovREqq1gLS
{
// People ordered by Nobel prize year
"peopleByPrizeYear": *[]|order(prizes[0].year desc){
"name": firstname + " " + surname,
"orderYear": prizes[0].year,
prizes
},
// List of all prizes ordered by year awarded
"allPrizes": *[].prizes[]|order(year desc)
}
// Get all Nobel prizes from all root person documents
// https://groq.dev/v8T0DQawC6ihbNUf4cUeeS
*[].prizes[]
array::join(tags, ", ") // tags = ["Rust", "Go", null, "GROQ"] => "Rust, Go, <INVALID>, GROQ"
array::join(["a", "b", "c"], ".") // "a.b.c"
array::join(year, ".") // year = 2024 => null (not an array)
array::join(values, 1) // values = [10, 20, 30] => null (separator must be a string)
array::compact(numbers) // numbers = [1, null, 2, null, 3] => [1, 2, 3]
array::unique(items) // items = [1, 2, 2, 3, 4, 5, 5] => [1, 2, 3, 4, 5]
array::unique(records) // records = [[1], [1]] => [[1], [1]] (arrays are not comparable)
array::intersects(firstList, secondList) // firstList = [1, 2, 3], secondList = [3, 4, 5] => true
array::intersects(tags, keywords) // tags = ["tech", "science"], keywords = ["art", "design"] => false此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。