Simple data structure with many names like dictionaries, loops, classifications, types,... - you name it.

In CodeMash, Taxonomy is a type of collection where you store simple structural data; usually, you refer to that data in database collections (a.k.a tables). When you want to classify and group simple structure data, it would be best to choose taxonomy.

Good examples of taxonomy would be:

  • Countries

  • Cities

  • Order Statuses (Pending, In Progress, Paid, Completed, ...)

  • Event Types (Course, Webinar, Conference, ...)

  • Work Item Types (Polishing, Service, Replacement of parts, Assembling, Dissasembling, ...)

Use the Taxonomy rule of thumb

Selected list items below are the perfect match to make data as a taxonomy:

if you are unsure if it will be changed later by some company policy change (the company can decide to have a new type called "Contractor"), it might be better to stick with taxonomy instead of having this as a database enum field.

When not to use Taxonomy

Please consider if it makes sense to have your data as taxonomy when:

  1. The data list is short and with well-known and finished scope. E.g., Imperial units of measurement is a perfect match for the Enum database field rather than Taxonomy

    • Foot (feet)

    • Inches (inch)

    • Mile

    • Yard

  2. Data is complex, with many additional fields. Taxonomy doesn't support all the fields the database collection schema does. You can extend taxonomy with custom fields, but those fields are stored under _meta property, so querying data is a bit more complicated.

Creating taxonomies

You can see and create a new taxonomy on our dashboard page:

  • Go to Database

  • Choose Taxonomies

  • Here you can see all your project taxonomies, and you can create a new one by pressing the "Add New" button

1:N relationship

Let's say you want a country's list of corresponding states and cities. Such structure is explained below:

So we have three taxonomies here - Countries, States, and Cities. The parent of the taxonomy States is taxonomy Countries, and the parent of the taxonomy Cities is, of course, States' taxonomy. Le's follow the instructions defined below to achieve such functionality:

  1. Add new taxonomy (Database -> Taxonomies -> Add New) called "Countries."

  2. Add new taxonomy called "States."

  3. Add new taxonomy called "Cities."

  4. Go to States' taxonomy and press the taxonomy settings page.

    1. From the list of all taxonomies...

    2. ....or from the Taxonomy terms page

  5. Point the parent property of the taxonomy of States to the taxonomy of Countries.

  6. Point the parent property of the taxonomy of Cities to the taxonomy of States. The same as you did in the 5th step.

  7. Fill in Countries. Go to Database -> Taxonomies -> Countries and add countries.

  8. Fill in states. Now for each state, you can refer country accordingly.

  9. Repeat it with cities.

Congratulations. Mission accomplished.

Now you can fetch such structure in any of your projects.

  • You can get all the hierarchical data in a one bunch

  • You can get those cities, countries, and states translated into your language. Terms localization

  • You can expand your taxonomy schema and add more relevant data to your project, e.g., country flag and VAT percentage for goods...

Extending Taxonomy schema

Sometimes having an id and value data type is not enough. You often want to extend it a bit, add one extra digital number representing the country's population, or add some flag of the country that you can fetch from your mobile app. Are you forced for such a change to use Collection rather than taxonomy? Well, if the extension is simple, we have you covered. Please follow this page to see capabilities.


Taxonomy records are called terms.

API reference

Get Terms

Last updated