added metadata sort to the getAnnotations function
This reduces the two two getAnnotations functions to the single getAnnotations function. The new sorting by metadata.target is added.
$sort: {
'_metadata.target.selector.value': reverse ? -1 : 1
},
Edited by Koch, Anton