Query cosmosdb using partition key

Viewed 4343

I have an employee dto with department as partitionKey.

  1. How to get number of partition at any given of point of time?
  2. How to query cosmosdb(documentDB) using partitionKey, either query explorer or java api will do?

What I tried:

List<Document> documentList = documentClient.queryDocuments(getCollection().getSelfLink(),"SELECT * FROM root r WHERE r.partitionKey ='" + partitionKey+"'", null).getQueryIterable().toList();

I end up getting IllegalStateException state exception from java api and query exporter also did't give any output. Any help is highly appreciable.

2 Answers
Related