Not contains query

Hi All,
I am trying to filter a dataset using the not contains query but it seems like it is not available under the filter options for the dataset. So I tried to do it under the onReady() function and this is the code.

$w(‘#dataset1’).setFilter(wixData.filter().not(wixData.query(‘Products’).contains(‘sku’, ‘Special Product’)))
where dataset1 is the dataset and Products is the collection name.

However this code is not working. How do I write not contains query then? Thanks.

Hi,

Check out the note for the setFilter function

In general, you’ll need to pass the setFilter object to the .not() function:

let filter = wixData.filter();
    filter = filter.not(filter.contains('sku', 'Special Product'));
    $w("#dataset1").setFilter(filter);