What is the syntax to filter a dictionary item?

In my migration I have an “address” dictionary

           .field("address", .dictionary, .required)

With the following dictionary items

address1
address2
city
state
zip

I tried a number of filter combinations that don’t pass the compile.

.filter(.$address.state == “CA”)
.filter(.$address[state] == “CA”)
.filter(.$address.$state == “CA”)

What is the syntax to filter a dictionary item?

Fluent translates that to JSON under the hood IIRC which has no Fluent query equivalent so you’ll probably need to drop down to a raw query for it.

As an aside - if it’s limited to a set number of fields I’d just flatten it into the model, or do so using a Fluent Group if you want to be able to address it nicely from Swift