Skip to main content

RANKED_COUNT_ORDER_KEY

Constant RANKED_COUNT_ORDER_KEY 

Source
pub const RANKED_COUNT_ORDER_KEY: &str = "$count";
Expand description

The ORDER BY field name that means “the group’s COUNT(*)”.

COUNT(*) has no field to name, so the ranked grammar needs some token for “order by the thing the select projects”. $count is chosen because the leading $ is DPP’s system-property namespace ($id, $ownerId, $revision, $createdAt, …): a document schema cannot declare a property whose name starts with $, so the sentinel is guaranteed not to collide with any real property a contract author could write, now or in any future contract. That is the whole reason it is spelled with a sigil rather than as "count" — a bare count would silently hijack ordering for any schema that happens to have a count column.