Bases `exists` filter isn't restricted to `!= undefined`

Steps to reproduce

  1. create some notes with a checkbox property. Let’s call the property foo;
  2. check the property foo on some notes, but not all of them;
  3. create a bar.bases YAML;
  4. set a filter for the property foo as exists;
  5. see that only the notes with the property foo checked are shown;
  6. add another filter requiring foo to be unchecked;
  7. no notes are shown.

Did you follow the troubleshooting guide? [Y/N]

Yes! I’ve created a new vault just to test this case.

Expected result

The exists filter should check for the property’s presence, not it’s value. So, notes with the property present, but unchecked should be shown.

Actual result

Only the notes with the property checked are shown. So, using the exists filter has no use.

Environment

SYSTEM INFO:
	Obsidian version: v1.9.6
	Installer version: v1.8.10
	Operating system: Windows 11 Home 10.0.26100
	Login status: logged in
	Language: en
	Catalyst license: insider
	Insider build toggle: on
	Live preview: on
	Base theme: adapt to system
	Community theme: none
	Snippets enabled: 0
	Restricted mode: on

RECOMMENDATIONS:
	none

Additional information

@sobral to check if a property exists (even if it Empty/Null), you can use:

note.keys().contains("property-name")

We may change what Exists translates to in the UI.

1 Like

Thank you, @WhiteNoise !

Yeah, “Exists” isn’t a good translation for isTruthy. However, I really like to have “Exists” as an option on the UI. It’s easy to understand what it should do.

My new tests are using:


    filters:
      and:
        - note.keys().contains("foo")

And:


    filters:
      and:
        - note.keys().contains("foo")
        - note["foo"] == false

Thank you!