mention that JSON operators work for row filtering (#314)

This commit is contained in:
fiatjaf
2020-04-01 11:00:05 -05:00
committed by GitHub
parent 36c453d6de
commit b7ee8f1cf0
+7 -4
View File
@@ -200,17 +200,20 @@ You can specify a path for a ``json`` or ``jsonb`` column using the arrow operat
GET /people?select=id,json_data->>blood_type,json_data->phones HTTP/1.1
[
{ "id": 1, "blood_type": "A+", "phones": [{"country_code": "61", "number": "917-929-5745"}] },
{ "id": 1, "blood_type": "A-", "phones": [{"country_code": "61", "number": "917-929-5745"}] },
{ "id": 2, "blood_type": "O+", "phones": [{"country_code": "43", "number": "512-446-4988"}, {"country_code": "43", "number": "213-891-5979"}] }
]
That also works with filters:
.. code-block:: http
GET /people?select=id,json_data->phones->0->>number HTTP/1.1
GET /people?select=id,json_data->blood_type&json_data->>blood_type=eq.A- HTTP/1.1
[
{ "id": 1, "number": "917-929-5745"},
{ "id": 2, "number": "512-446-4988"}
{ "id": 1, "blood_type": "A-" },
{ "id": 3, "blood_type": "A-" },
{ "id": 7, "blood_type": "A-" }
]
.. _computed_cols: