How to test for an item with custom model data in Minecraft

I havent done stuff with command blocks for a while, so I'm a bit rusty. I'm trying to make something with a wand in it and I'm using a custom model for the wand. I want to test if my selected item is a carrot on a stick with a specific CustomModelData.

This is what I've tried so far:

execute if entity @p[nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",CustomModelData:10000001}}]

This doesn't give me any output and says test failed, even though I am holding an item that meets all the requirements. Does it matter that the item I am using also has other tags (custom name, enchanted)? Thanks in advance.


CustomModelData is in tag.

execute if entity @p[nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",tag:{CustomModelData:10000001}}}]

One of my favourite commands can help in such a situation:

/data get entity @s SelectedItem