Filter nested documents with collectionlink -> _id fields,

hi there i have post tag relation collection and using it to solve many-to-many relation.
i’m trying to filter tags which is related exact post but i cant figure it out to filter by collection link _id
this is a snippet to show what i want to achieve

if (COCKPIT_API_REQUEST) {
    $app->on('collections.find.after.posts', function ($name, &$entries) use ($app) {
        foreach ($entries as &$entry) {
            $id = $entry["_id"];
            $tags = $this->module('collections')->find('tags',['_id' => $id]);//problem on filter
            if (!empty($tags)) {
            // foreach ($tags as &$tag) {
                //     $entry["linked"][]=$tag;
                // }
            } else {
                $entry["linked"][]="";
            }
        }
    });
}

related field is post and i need to filter post[_id] field

i tried
[‘post’][’_id] // no result
[‘post._id’ => $id] //all results no filter
[[‘account._id’] => $id] //Illegal offset type

Thanks in advance

i found solution posting here for someone needs
My goal was getting all posts with related tags included in this request (prevent from makng second request)
so 1st collection is

post

2nd collection

tags

3rd collection is

post-tags-relation

with snippets below i’m getting post entries and getting related tags for each post and adding them to the post entry.to filter relation collection i need to filter “_id” which is located

{
  "post": {
    "_id": "6135b668386234474e000304",  <--- here
    "link": "posts",
    "display": "aaaa"
  },
  "tag": {
    "_id": "61352dda346364830300027e",
    "link": "tags",
    "display": "IZMIR"
  },
  "_by": null,
  "_modified": 1631010110,
  "_created": 1630912806,
  "_id": "6135c126633863531c0001a6",
  "test": "1",
  "_mby": "5fb17db2316366342100001f"
}

and to filter those records

if (COCKPIT_API_REQUEST) {
    $app->on('collections.find.after.posts', function ($name, &$entries) use ($app) {
        foreach ($entries as &$entry) {
            $id = $entry["_id"];
            $tags = $this->module('collections')->find('post-tags-relation', ["filter"=>['tag._id' => $id]]);
            if (!empty($tags)) {
                foreach ($tags as &$tag) {
                    $entry["linked"][]=$tag["tag"];
                }
            } else {
                $entry["linked"][]="";
            }
        }
    });
}

I hope this helps someone needed who like i, desperately digging forum and google…