From da0423581ef07950bc2204f030d239eec2c961c2 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Sat, 28 Sep 2024 08:20:14 +0200 Subject: [PATCH] Correct JSON translation SQL --- conceptual/EFCore.PG/mapping/json.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conceptual/EFCore.PG/mapping/json.md b/conceptual/EFCore.PG/mapping/json.md index 78db86bc..c0c42245 100644 --- a/conceptual/EFCore.PG/mapping/json.md +++ b/conceptual/EFCore.PG/mapping/json.md @@ -255,7 +255,7 @@ EF.Functions.JsonTypeof(e.Customer.Age) .NET | SQL ------------------------------------------------------------------------------------- | ---- customer.RootElement.GetProperty("Name").GetString() | [customer->>'Name' = 'Joe'](https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSON-OP-TABLE) -customer.RootElement.GetProperty("Orders")[1].GetProperty("Price").GetInt32() | [customer#>>'{Orders,0,Price}'\[1\] = 8](https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSON-OP-TABLE) +customer.RootElement.GetProperty("Orders")[1].GetProperty("Price").GetInt32() | [CAST(customer #>> '{Orders,1,Price}' AS integer) = 8](https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSON-OP-TABLE) customer.RootElement.GetProperty("Orders").GetArrayLength() | [jsonb_array_length(customer->'Orders'](https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE) EF.Functions.JsonContains(customer, @"{""Name"": ""Joe"", ""Age"": 25}")1 | [customer @> '{"Name": "Joe", "Age": 25}'](https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSONB-OP-TABLE) EF.Functions.JsonContained(@"{""Name"": ""Joe"", ""Age"": 25}", customer)1 | ['{"Name": "Joe", "Age": 25}' <@ customer](https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSONB-OP-TABLE)