Filtering Read Only Collections

Hi,

I’m new to coding and want to do some thing like this

const collectionName = wixData.query("Blog/Posts").contains("categories", ["Food"]);

Is this the right place to put such a filter?

Am I I filtering it right?

also this gets filtered later using User input.
like in this example https://www.wix.com/corvid/example/filter-with-multiple-options

Any help will be appreciated