asArray
Converts an object to an array of objects with the given key and value
Arguments
object
- The object to convertkey
- The key to use for the new objectsvalue
- The value to use for the new objects
Example
Given scope
{
"testObject": {
"test1": "someVal",
"test2": "anotherVal"
}
}
for query
{
"$template": {
"test": "{{asArray(testObject, 'key', 'value')}}"
}
}
the result will be
[
{
"key": "test1",
"value": "someVal"
},
{
"key": "test2",
"value": "anotherVal"
}
]