diff --git a/pkg/yqlib/doc/Boolean Operators.md b/pkg/yqlib/doc/Boolean Operators.md index daebec08..0b8a5e5d 100644 --- a/pkg/yqlib/doc/Boolean Operators.md +++ b/pkg/yqlib/doc/Boolean Operators.md @@ -32,13 +32,13 @@ Given a sample.yml file of: ``` then ```bash -yq eval '.[] | select(.a == "cat" or .b == "dog")' sample.yml +yq eval '[.[] | select(.a == "cat" or .b == "dog")]' sample.yml ``` will output ```yaml -a: bird -b: dog -a: cat -b: fly +- a: bird + b: dog +- a: cat + b: fly ``` diff --git a/pkg/yqlib/operator_booleans_test.go b/pkg/yqlib/operator_booleans_test.go index 29275216..b21c4050 100644 --- a/pkg/yqlib/operator_booleans_test.go +++ b/pkg/yqlib/operator_booleans_test.go @@ -22,10 +22,9 @@ var booleanOperatorScenarios = []expressionScenario{ { document: "[{a: bird, b: dog}, {a: frog, b: bird}, {a: cat, b: fly}]", description: "Matching nodes with select, equals and or", - expression: `.[] | select(.a == "cat" or .b == "dog")`, + expression: `[.[] | select(.a == "cat" or .b == "dog")]`, expected: []string{ - "D0, P[0], (!!map)::{a: bird, b: dog}\n", - "D0, P[2], (!!map)::{a: cat, b: fly}\n", + "D0, P[], (!!seq)::- {a: bird, b: dog}\n- {a: cat, b: fly}\n", }, }, {