In documentDB partitioned collections, you need to know a partitionKey value to be able to execute a stored procedure against it. However, to be able to do something like a count stored procedure it has to work across all partitions or be executed for each partition.
This means a stored procedure can't be executed to produce a list of partition keys (AFAIK). Running a query to return every value of partitionkey in all the documents, then deduplicating it client side is a highly inelegant, brute force, expensive operation. You cannot SELECT DISTINCT.
How can one produce a list of partition keys, without resorting to the SELECT partitionkey FROM docs approach?