From 3b20967be9e8f142d4b1b4030ed3f003716129bd Mon Sep 17 00:00:00 2001 From: Jonas Staudenmeir Date: Mon, 8 Jul 2024 14:14:48 +0200 Subject: [PATCH] Improve database support for JSON queries --- queries.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/queries.md b/queries.md index ca6417d44d..8646b13551 100644 --- a/queries.md +++ b/queries.md @@ -552,7 +552,7 @@ WHERE published = true AND ( ### JSON Where Clauses -Laravel also supports querying JSON column types on databases that provide support for JSON column types. Currently, this includes MySQL 8.0+, PostgreSQL 12.0+, SQL Server 2017+, and SQLite 3.39.0+ (with the [JSON1 extension](https://www.sqlite.org/json1.html)). To query a JSON column, use the `->` operator: +Laravel also supports querying JSON column types on databases that provide support for JSON column types. Currently, this includes MariaDB 10.3+, MySQL 8.0+, PostgreSQL 12.0+, SQL Server 2017+, and SQLite 3.39.0+. To query a JSON column, use the `->` operator: $users = DB::table('users') ->where('preferences->dining->meal', 'salad') @@ -564,7 +564,7 @@ You may use `whereJsonContains` to query JSON arrays: ->whereJsonContains('options->languages', 'en') ->get(); -If your application uses the MySQL or PostgreSQL databases, you may pass an array of values to the `whereJsonContains` method: +If your application uses the MariaDB, MySQL, or PostgreSQL databases, you may pass an array of values to the `whereJsonContains` method: $users = DB::table('users') ->whereJsonContains('options->languages', ['en', 'de']) @@ -1045,7 +1045,7 @@ DB::table('users')->updateOrInsert( ### Updating JSON Columns -When updating a JSON column, you should use `->` syntax to update the appropriate key in the JSON object. This operation is supported on MySQL 5.7+ and PostgreSQL 9.5+: +When updating a JSON column, you should use `->` syntax to update the appropriate key in the JSON object. This operation is supported on MariaDB 10.3+, MySQL 5.7+, and PostgreSQL 9.5+: $affected = DB::table('users') ->where('id', 1)