The Cozy datastore stores documents, which can be seen as JSON objects. A doctype is simply a declaration of the fields in a given JSON object, to store similar objects in an homogeneous fashion.
Cozy ships a built-in list of doctypes for representation of most of the common documents (Bills, Contacts, Events, ...).
Whenever your app needs to use a given doctype, you should:
- Check if this is a standard
doctypedefined in Cozy itself. If this is the case, you should add a model declaration in your app containing at least the fields listed in the main fields list for thisdoctype. Note that you can extend the Cozy-provideddoctypewith your own customs fields. This is typically what is done in Konnectors for the Billdoctype. - If no standards
doctypesfit your needs, you should define your owndoctypein your app. In this case, you do not have to put any field you want in your model, but you should crosscheck other cozy apps to try to homogeneize the names of your fields, so that yourdoctypedata could be reused by other apps. This is typically the case for the Konnectordoctypein Konnectors.