How to filter by empty reference field?

Can you help? I’m trying to filter a dataset and only show items that have the empty reference field “Card”. I would have thought this would have done it, but it doesn’t, I get an uncaught promise.

    $w('#dataset4Quotes').setFilter(wixData.filter()
        .hasSome("keywords", selectedQuoteKeywords)
        .isEmpty("Card")
        )

I tried adding in .include(“Card”) that didn’t work.

I’ve looked at the API for query and queryreferenced, and searched the forum but can’t see the solution I’m looking for.

Any help would be appreciated.

Thanks

Hello mrpowergage,

perhaps this works for you…

import wixData from 'wix-data';

$w('#dataset4Quotes').setFilter( wixData.filter()
  .hasSome("keywords", selectedQuoteKeywords)
  .isEmpty("Card")
)
.then( () => {
  console.log("Dataset is now filtered");
  
} )
.catch( (err) => {
  console.log(err);
} );

Not tested!

Thanks russian-dima,

It isn’t throwing an error anymore, but it’s not providing the results as expected either.

FYI if I remove .isEmpty( “Card” ) it works as expected

try this one, instead of —> .isEmpty. Perhaps this works.

.eq("Card", "")

not working…