How to filter records by related Id field using v2 API?

Hi everyone!

I am looking for the right way for filtering records by relational Id field via API.

Basic Problem:
Table Books has link many-to-many field Authors
I need to filter Books by related Author Ids: [1,2]

Currently, from the docs I would consider pretty much the only solution:

  1. get Authors with “where=(Id,in,1,2)”
  2. For each author, query get Book links using Author links retrieval endpoint.
  3. get Books with “where=(Id,in, id1,id2…)” ids from step 2

However, this seems an awful solution to me, I believe there is a more efficient approach.
Could somebody advice on that, please?

P.S
I could think of using lookup field on Books table called author_ids and filter by those directly, but nocodb interface doesn’t allow to create lookups on Id fields. So I am out of ideas here

Currently, it’s not possible to filter parent records directly based on child IDs. We’ll consider adding support for an in filter in the future. Created an issue in our Github - 🔦 Feature: Record filter based on linked records · Issue #9834 · nocodb/nocodb · GitHub

For now, a potential solution is to retrieve books for each author individually using the List Linked Records API.