nicer reduce example

This commit is contained in:
Mike Farah 2021-02-15 17:33:41 +11:00
parent 9072e8d3b3
commit ee1f55630f

View File

@ -26,7 +26,7 @@ var reduceOperatorScenarios = []expressionScenario{
subdescription: "The _$context_ variable set by reduce lets you access the data outside the reduce block.", subdescription: "The _$context_ variable set by reduce lets you access the data outside the reduce block.",
document: `a: cat`, document: `a: cat`,
document2: `b: dog`, document2: `b: dog`,
expression: `fileIndex as $item ireduce ({}; . * ($context | select(fileIndex==$item)) )`, expression: `fi as $item ireduce ({}; . * ($context | select(fileIndex==$item)) )`,
expected: []string{ expected: []string{
"D0, P[], (!!map)::a: cat\nb: dog\n", "D0, P[], (!!map)::a: cat\nb: dog\n",
}, },