Je sélectionne certains documents et j'affecte le résultat à un tableau ainsi :
{{#load
type="movement"
where="$$.direction = 'entrée'"
assign="movements."
order="$$.date"
}}
{{/load}}
{{:debug movements=$movements}}
Dans mon tableau, je récupère chaque élément deux fois :
["movements"]=> array(30) {
[0]=> array(3) {
["id"]=> int(57)
["key"]=> string(36)
"29c8dbf2-2877-4660-bf6c-975a0b138f92"
["json"]=> string(162)
"{"type":"movement","direction":"entr\u00e9e","inputNature":"Achat","amount":1,"equipment":"6951ff2d-9957-480c-a4db-271937688516","date":"2020-06-10","comment":""}"
}
[1]=> array(9) {
["id"]=> int(57)
["key"]=> string(36)
"29c8dbf2-2877-4660-bf6c-975a0b138f92"
["type"]=> string(8) "movement"
["direction"]=> string(7) "entrée"
["inputNature"]=> string(5) "Achat"
["amount"]=> int(1)
["equipment"]=> string(36)
"6951ff2d-9957-480c-a4db-271937688516"
["date"]=> string(10) "2020-06-10"
["comment"]=> string(0) ""
}
Bizarre, n'est-il pas ?
Le problème ne se pose pas avec #select...
Effectivement, comme #load utilisait #sql, #sql faisait un assign avant
le json_decode, et #load après le json_decode.
J'ai corrigé, merci du signalement.