https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
f

fresh-yacht-99561

05/13/2022, 2:17 PM
Hi All. I recently started using Growthbook and I’m in the process of setting up some of my first features. Right now I’m just testing in our staging environment and setting up some force rules. When I use
id is equal to
it works as expected but when I use
id is in the list
, the users in the list are not being served the correct feature. Has anyone else experienced this and/or does anyone have tips to get this working? Thanks!
f

future-teacher-7046

05/13/2022, 2:22 PM
Hi Melissa. Can you click the "advanced" mode when entering targeting conditions and see if it's parsing everything correctly into JSON?
f

fresh-yacht-99561

05/13/2022, 2:24 PM
Yes I tried that and it looks right to me. Here is a screenshot.
f

future-teacher-7046

05/13/2022, 2:24 PM
Hmm. What SDK are you using?
f

fresh-yacht-99561

05/13/2022, 2:25 PM
We’re using the React SDK
"@growthbook/growthbook-react": "^0.8.1",
f

future-teacher-7046

05/13/2022, 2:26 PM
Are the ids you are passing into the SDK strings or numbers?
f

fresh-yacht-99561

05/13/2022, 2:28 PM
They’re numbers
f

future-teacher-7046

05/13/2022, 2:29 PM
Ok, that's probably the issue then. In GrowthBook, under Settings -> Attributes, you can change the data type of id to be Number so it matches what you are passing into the SDK
After that, if you edit the rule and then save it, it should store the condition as this instead:
Copy code
{
  "id": {
    "$in": [
      762,
      2891
    ]
  }
}
f

fresh-yacht-99561

05/13/2022, 2:36 PM
Let me try that out! Thanks for your help!
Interesting that it works as a string when it’s just one user id with is equal to though
f

future-teacher-7046

05/13/2022, 2:37 PM
yeah, the javascript SDK must not be doing strict comparison for that operator. We should probably fix that
f

fresh-yacht-99561

05/13/2022, 2:37 PM
Thanks so much for the quick response though. Really liking Growthbook so far! 🙂
Changing the id type to number seems to be working - thanks!
20 Views