I'm trying to find a way filter js collection with a query syntax similar to SQL.
The only library I found to accomplish this task is json-query.
It works in some cases but it has limitations. It isn't possible to query on different object levels with the same query or query for more than one result.
Here are some examples (Take the datastructure below as reference)
[{
"type": "UU",
"value": "100",
"tipo": "G",
"strumento": "P",
"aspetto": "C",
"unit": "ml"
},
{
"type": "PS",
"value": "120/88",
"rilevamento": "Manuale",
"lato": "SX",
"part": "Supina",
"unit": "mmHg"
},
{
"type": "TP",
"value": "33.6",
"tipo": "T",
"unit": "°C"
},
{
"type": "VO",
"value": "12",
"tipo": "VOAL",
"unit": "ml"
},
{
"type": "RS",
"value": "60",
"unit": "atti/min"
},
{
"type": "HH",
"value": "180",
"modalita": "R",
"unit": "cm"
},
{
"type": "AA",
"value": "50",
"unit": "cm"
},
{
"type": "PO",
"value": "70",
"rilevamento": "Manuale",
"tipo": "FA",
"sede": "PC",
"unit": "bpm"
}
]
- type = TP with value > 30
[type=TP & value>30] (works with json-query)
- type = TP with value > 30 AND type = UU with value > 90
[type=TP & value>30 & type = UU with value > 90](not working with json-query)