# Ecto.Enum select underlying id

**URL:** <https://forum.elixirforum.com/t/ecto-enum-select-underlying-id/46353>\
**Category:** Questions\
**Tags:** ecto, postgresql, ecto\_enum\
**Created:** [March 2, 2022, 7:31am UTC](https://forum.elixirforum.com/t/ecto-enum-select-underlying-id/46353 "2022-03-02T07:31:45Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![LostKobrakai](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lostkobrakai/32/3072_2.png) [@LostKobrakai](https://forum.elixirforum.com/u/LostKobrakai)\
**Post date:** [March 2, 2022, 9:23am UTC](https://forum.elixirforum.com/t/ecto-enum-select-underlying-id/46353/4 "2022-03-02T09:23:53Z")

</div>

The whole idea of `Ecto.Enum` is to not spread the persisted value (the integers in your case) all over the codebase. You’re expected to use the atoms wherever you interact with the field, not the integers. Otherwise you could just use an `:integer` field to begin with.

But also there’s `Ecto.Enum.mappings` if you want to map between the representations.

---

_[View the full topic](https://forum.elixirforum.com/t/ecto-enum-select-underlying-id/46353)._
