Query page or section data models by input filed that is array of references?

Hello,

I want to ask if it is possible to query data model by its input filed which is array of references.

I have this filed in the data model inputs:

And when i fetch the data from the builder io like this:

  const getAllResources = await builder.getAll('resources', {
        options: { enrich: true },
        includeUnpublished: true,
      });

i get the following response:

Now, what i want to do is to add query to builder.getAll request and query the response by tag id, because i have the id of the tag.

i tried something like this:

   const getAllResources = await builder.getAll('resources', {
        options: { enrich: true },
        includeUnpublished: true,
        query: {
          'data.tags': {
            $elemMatch: {
              tag: {
                id: tagId,
              },
            },
          },
        },
      });

But i got empty array as a response …

Actually this question i relevant for the visual editor as well, because there is no way to filter from the admin panel as well, like this:

Even though i have these tags in some of the pages i get No content Found

Found the answer, for the query in my source code…

The query needed to be constructed like this:

    const getAllResources = await builder.getAll('resources', {
          options: { enrich: true },
          includeUnpublished: true,
          query: {
            'data.tags': {
              $elemMatch: {
                'tag.id': tagId,
              },
            },
          },
        });

// OR

   const getAllResources = await builder.getAll('resources', {
          options: { enrich: true },
          includeUnpublished: true,
          query: {
            data: {
              tags: {
                $elemMatch: {
                  'tag.id': tagId,
                },
              },
            },
          },
        });

:information_source:
However, the problem in the admin panel/dashboard and the filtering by tag is still not possible, and i have not been able to do anything about it.