Added another delete example

This commit is contained in:
Mike Farah
2021-02-11 10:58:40 +11:00
parent 2a6e423d2d
commit db62a16007
4 changed files with 30 additions and 2 deletions
+8
View File
@@ -61,6 +61,14 @@ var deleteOperatorScenarios = []expressionScenario{
"D0, P[], (doc)::{b: dog}\n",
},
},
{
description: "Recursively delete matching keys",
document: `{a: {name: frog, b: {name: blog, age: 12}}}`,
expression: `del(.. | select(has("name")).name)`,
expected: []string{
"D0, P[], (!!map)::{a: {b: {age: 12}}}\n",
},
},
}
func TestDeleteOperatorScenarios(t *testing.T) {