diff --git a/content/collections/docs/content-queries.md b/content/collections/docs/content-queries.md index 0a6f87f66..f432cd003 100644 --- a/content/collections/docs/content-queries.md +++ b/content/collections/docs/content-queries.md @@ -310,7 +310,7 @@ Entry::query() ->get(); ``` -Or can pass an array of values. This will match if any of the values are found in the field. +Or can pass an array of values. This will match if **all** of the values are found in the field. ```php Entry::query() @@ -318,12 +318,24 @@ Entry::query() ->get(); ``` -You can use `whereJsonDoesntContain()` to query the absence of a value or values in a JSON array: +If you want to check for **any** value being present, use whereJsonOverlaps. + +```php +Entry::query() + ->whereJsonOverlaps('my_array_field->sub_field', ['statamic', 'is', 'rad']) // [tl! ~~] + ->get(); +``` + +You can use `whereJsonDoesntContain()` and `whereJsonDoesntOverlap()` to query the absence of a value or values in a JSON array: ```php Entry::query() ->whereJsonDoesntContain('my_array_field->sub_field', 'statamic') // [tl! ~~] ->get(); + +Entry::query() + ->whereJsonDoesntOverlap('my_array_field->sub_field', 'statamic') // [tl! ~~] + ->get(); ``` You can use whereJsonLength method to query JSON arrays by their length: