Auto-generate, auto-increment primary key

You can achieve an auto-generated, auto-incremented field with a few lines of code using a data hook. Most probably, you’ll want to use the beforeInsert hook.

You can learn more about data hooks by reading About Data Hooks , How to Use Data Hooks , and referring to the data hooks API .