SortQ

General Usage


The 'sortq' query parameter can be used within a supporting call to sort results by a specific field. 'sortq' supports most of the syntax used by MongoDB db.sort()



How do I use 'sortq'?

With the syntax {field:value}, value being 1 for ascending ordering and -1 for descending ordering. All the results can be sorted by _id but some collections have extra fields:

Regulatory List: name, entry_count

Substance: regulatory_burden, name_sort, cas_sort, cas_sort_string

Entries: regulatory_list_id, substance_id, release_id, name_sort, cas_sort, cas_sort_string, regulatory_list_name

Tag: name



Specific sort field:

name_sort sort by primary_name

cas_sort sort by CAS number ( as found in identifiers.identifier with name = CAS) considered as a numeric value

cas_sort_string sort by CAS Number considered as a string value

display_sort sort by display information (as found in chemical_data.display)



Example:

Resource Returns q
Regulatory List Sort by descending entry count {entry_count:_1}
Tag Sort by ascending id {_id:1}
Substance Sort by descending primary name {name_sort:-1}
Entry Sort by ascending display value {display_sort:1}