Getting unique versions of MITRE ATT&CK objects

This answer shows all the versions of ATT&CK an object appears in

However, often between ATT&CK versions an object is not changed at all.

How can I show all distinct versions of an object that exist?

When an update to an object happens, the modified property increases.

So therefore you can get a list of modified times to show how many distinct versions exist.

e.g. for attack-pattern--2bce5b30-7014-4a5d-ade7-12913fe6ac36 (T1070.002)

FOR doc IN mitre_attack_enterprise_vertex_collection
    FILTER LENGTH(doc.external_references) > 0
    FOR ref IN doc.external_references
        FILTER ref.source_name == "mitre-attack" AND ref.external_id == "T1070.002"
        COLLECT modified = doc.modified INTO groups
        RETURN {
            "id": FIRST(groups).doc.id,
            "versions": modified
        }
[
  {
    "id": "attack-pattern--2bce5b30-7014-4a5d-ade7-12913fe6ac36",
    "versions": "2020-03-29T21:23:51.886Z"
  },
  {
    "id": "attack-pattern--2bce5b30-7014-4a5d-ade7-12913fe6ac36",
    "versions": "2021-04-29T14:49:39.188Z"
  }
]

If you’re interested in the ATT&CK versions each version is found in…

FOR doc IN mitre_attack_enterprise_vertex_collection
    FILTER LENGTH(doc.external_references) > 0
    FOR ref IN doc.external_references
        FILTER ref.source_name == "mitre-attack" AND ref.external_id == "T1070.002"
        COLLECT modified = doc.modified INTO groups
        RETURN {
            "id": FIRST(groups).doc.id,
            "versions": modified,
            "stix2arango_notes": UNIQUE(FLATTEN(groups[*].doc._stix2arango_note))
        }
FOR doc IN mitre_attack_enterprise_vertex_collection
    FILTER LENGTH(doc.external_references) > 0
    FOR ref IN doc.external_references
        FILTER ref.source_name == "mitre-attack" AND ref.external_id == "T1070.002"
        COLLECT modified = doc.modified INTO groups
        RETURN {
            "id": FIRST(groups).doc.id,
            "versions": modified,
            "stix2arango_notes": UNIQUE(FLATTEN(groups[*].doc._stix2arango_note))
        }