@Eloy Definitely sounds like the set account relation would work well for this use case. Otherwise you’d need to query the document content to filter on the environment. Should be possible to use the flight-sql API to construct a SQL query to do that.
Also for future reference, it would be better to open new forum posts for questions like these, rather than putting them in the comments on this post about the end of Ceramic core feature development.