Skip to content

Commit

Permalink
Correct JSON translation SQL
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Sep 28, 2024
1 parent f31c01f commit da04235
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion conceptual/EFCore.PG/mapping/json.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}")<sup>1</sup> | [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)<sup>1</sup> | ['{"Name": "Joe", "Age": 25}' <@ customer](https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSONB-OP-TABLE)
Expand Down

0 comments on commit da04235

Please sign in to comment.