Multiple criteria for data query

I have looked and looked for syntax to be able to create an “and” condition when making a Wix data query. Thank you to Jeff (Wix) from a post in 2017 that I never found before today.

The quick answer is adding the .hasSome(“[field name]”,“[value]”) to the query. For example:

wixData . query ( “Announcements” )

        . eq ( "hidden" ,  **false** ) 
        //filter on what's in "page" field (this acts like "and" in the find) 
        . hasSome ( "page" ,  "main" ) 
        . find () 

Here’s more documentation on “.hasSome”

This made my day!

Comments were closed on Jeff’s post so I added this one in case it is helpful for someone else.

1 Like