How do you query an Element by a custom field in Craft 3? My first try, according to craftcms/docs was:
$country = Entry::find()
->section('countries')
->where(['LIKE', 'code', 'CA'])->one()
But this throws an exception. Here code
is a custom text field. I've also tried some answers on stack exchange and many other combinations but they're for craftCraft 2 and neither they work.