Can anyone help me to search inside json datatype of Postgres database.
I have one table say transactions
and contains following like values array:
column: "data" datatype: json
Single demo transaction:
{
"id": "tran_54645bcb98ba7acfe204",
"amount": 4200,
...
"fees": [
{
"type": "application",
"application": "app_1d70acbf80c8c35ce83680715c06be0d15c06be0d",
"payment": "pay_917018675b21ca03c4fb",
"amount": 420,
"currency": "EUR",
"billed_at": null
}
]
}
Nested transaction list:
[
{
"id": "tran_54645bcb98ba7acfe204",
"amount": 4200,
"fees": [
{
"type": "application",
"application": "app_1d70acbf80c8c35ce83680715c06be0d15c06be0d",
"payment": "pay_917018675b21ca03c4fb",
"amount": 420,
"currency": "EUR",
"billed_at": null
}
]
},
{
"id": "tran_98645bcb98ba7acfe204",
"amount": 4200,
"fees": [
{
"type": "application",
"application": "app_1d70acbf80c8c35ce83680715c06be0d15c06be0d",
"payment": "pay_917018675b21ca03c4fb",
"amount": 120,
"currency": "AUD",
"billed_at": null
}
]
}
]
If I want to get all the transactions having amount > 300
AND also with currency = EUR
how I can get them?
I am new to Postgres so need help in understanding query building for Postgres nosql specially with PHP