I want to know the query to fetch all the documents present in database. I am aware of the query which will fetch the documents present under a particular folder. Below is the example for the same(getting count).
fn.count(xdmp.directory(["/dir1/"],"1"));
But I want to know how to fetch all documents in the database.
You could use the following to count all of the documents:
fn.count(fn.doc())
Or you could use cts.estimate() for a fast estimate of a search for document fragments:
cts.estimate(cts.trueQuery(), 'document')
Applying that criteria to cts.search()
:
cts.search(cts.trueQuery(), 'document')