0

I am using Marklogic 7 Rest API and I want to find out the number of documents in any collection in my Marklogic database. How can this be achieved?

Ranvir
  • 2,094
  • 2
  • 19
  • 26
Ankit Bhardwaj
  • 754
  • 8
  • 27

1 Answers1

2

You can POST a query on the collection with a page length of 1:

{"query": { "queries": [{ "collection-query": { "uri": ["YOUR_COLLECTION"] } }] }}

http://docs.marklogic.com/REST/POST/v1/search

http://docs.marklogic.com/guide/search-dev/structured-query#id_76890

The total property in the search response will indicate the number of documents in the collection.

ehennum
  • 7,295
  • 13
  • 9