Adding and Filtering Multiple IDs to a 'permissions' Field

TLDR Sean sought advice on restricting document access by adding multiple numeric IDs to a 'permissions' field. Sandip confirmed it was possible and provided a search request example.

Photo of Sean
Sean
Tue, 29 Aug 2023 17:25:20 UTC

I’m looking at a way to restrict documents from a collection to specific users in my app. Is it possible to add multiple numeric ID’s to a field? Thinking something like a field called ‘permissions’ which can have multiple ID’s, i.e, [123, 124, 125]. Then in the users search, we can add their ID to the filterBy parameter i.e. filterBy: 124, so that we only get results where there ID is included?

Photo of Sandip
Sandip
Tue, 29 Aug 2023 17:36:56 UTC

Yup, it is possible. search request should be ```filter_by:permissions:=124```

Photo of Sean
Sean
Tue, 29 Aug 2023 17:38:15 UTC

Great, actually, just seen in the docs that I can add an array of integers too. perfect!

Photo of Sandip
Sandip
Tue, 29 Aug 2023 17:38:38 UTC

:+1: