From 229bc778864911e2fbcb37079323bf9cf8a3c3ca Mon Sep 17 00:00:00 2001 From: Laurence Isla Date: Tue, 20 Feb 2024 17:15:42 -0500 Subject: [PATCH] docs: using `or` across embedded resources --- docs/references/api/resource_embedding.rst | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/references/api/resource_embedding.rst b/docs/references/api/resource_embedding.rst index 8e0e79ddf..7fd28652d 100644 --- a/docs/references/api/resource_embedding.rst +++ b/docs/references/api/resource_embedding.rst @@ -846,12 +846,14 @@ This sorts the list of actors in each film but does *not* change the order of th Once again, this restricts the roles included to certain characters but does not filter the films in any way. Films without any of those characters would be included along with empty character lists. -An ``or`` filter can be used for a similar operation: +An ``or`` filter can be used for a similar operation: .. code-block:: bash curl "http://localhost:3000/films?select=*,roles(*)&roles.or=(character.eq.Gummo,character.eq.Zeppo)" +However, this only works for columns inside ``roles``. See :ref:`how to use "or" across multiple resources `. + Limit and offset operations are possible: .. code-block:: bash @@ -951,6 +953,18 @@ Both ``is.null`` and ``not.is.null`` can be included inside the `or` operator. F curl "http://localhost:3000/films?select=title,actors(*),directors(*)&or=(actors.is.null,directors.is.null)" +.. _or_embed_rels: + +OR filtering across Embedded Resources +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You can also use ``not.is.null`` to make an ``or`` filter across multiple resources. +For instance, to show the films whose actors **or** directors are named John: + +.. code-block:: bash + + curl "http://localhost:3000/films?select=title,actors(),directors()&directors.first_name=eq.John&actors.first_name=eq.John&or=(directors.not.is.null,actors.not.is.null)" + .. _empty_embed: Empty Embed