Getting a subset of videos
If you want to get a subset of videos from a project based on arbitrary values in the video object, queries are what you want!
It might sound a little daunting but given some use cases the code you have to provide is super simple:
This method of querying is super powerful, and allows you to do very cool stuff that makes other development tasks simpler.
Let’s say we have a backend where we handle our users, users can belong to a group and you store the groupId in the userdata.group field in a video object when it is uploaded.
Now let’s say we want to get all the videos for a user, that user belongs to a list of groups with groupIds: [99, 23, 31, 76, 22] but only if they are uploaded within the last week. And we want to list the show the thumbnail and the group name, so all we really need is the video id, thumbnail url, and the groupId that the video belonged to.
This will then return an array of json objects with the just the values i needed.
Note: You can throw errors from within the filter. When throwing an error, the execution is stopped, and only that one error is returned.