Indicating the default application for a given mimetype is done by writing into the group [Default Applications] in the file mimeapps.list.
The [Default Applications] group indicates the preferred application for a given mimetype. This is for instance the one that will be started when left-clicking on a file in a file manager. If the application is no longer installed, the next application in the list is used.
This example ensures that the application default1.desktop will be used for mimetype1, if it's installed, and otherwise default2.desktop if it's installed:
[Default Applications] mimetype1=default1.desktop;default2.desktop
The value is a semicolon-separated list of desktop file IDs (as defined in the desktop entry spec).
In the absence of such an entry, the next mimeapps.list is checked. Once all levels have been checked, if no entry could be found, the implementations can pick any of the .desktop files associated with the mimetype, taking into account added and removed associations as per the next section.