https://www.growthbook.io/ logo
#announcements
Title
# announcements
h

helpful-carpenter-3208

03/14/2022, 12:47 PM
One question related with feature conditions, does it support to use nested json field or even array? Like we have the user attribute as
Copy code
{ address: {state: 'CA'}}
And we can add
address.state
in the JSON rule
f

future-teacher-7046

03/14/2022, 12:48 PM
yes, that's supported. Under Settings->Attributes, you can define attributes with dot notation. So if you add an attribute
address.state
as a string, it should show up in the dropdown when adding conditions.
h

helpful-carpenter-3208

03/14/2022, 12:49 PM
Cool! so it support the lodash syntax right?
f

future-teacher-7046

03/14/2022, 12:50 PM
we modeled it after MongoDB query syntax
arrays are a little trickier to deal with than nested objects. If you want at least one array element to match a condition, you can use
$elemMatch
. For example, if you have an array of address objects instead of just a single address:
Copy code
{
  "addresses": {
    "$elemMatch": {
      "state": "CA"
    }
  }
}
h

helpful-carpenter-3208

03/14/2022, 1:53 PM
interesting, I will check with MongoDB query syntax. Thanks~
11 Views