Wiki source for MarkLogicList


Show raw source

======Mark Logic Command: list======
Lists all documents in a Mark Logic server

====Synopsis====
list [options] [directory ...]

====Description====
Lists documents residing on a Mark Logic server and outputs to stdout.
With no directory arguement it lists all documents. This might exceed the server's memory.
With directory arguments then the list is constrained to documents in that directory.



||-c,-connect uri||Use the connection string instead of $MLCONNECT||
||-r||recurse||
||directory||Optional directory to list||


====Example====
Assuming the prefix "ml" is imported as the marklogic module, prints to stdout (one uri per line) all the documents in the database.

%%
ml:list
%%

This can produce a very large output as it includes ALL documents in the database.

To limit documents to a single directory use

%%
ml:list /Dir/
%%




====Implementation====

list is implemented as a simple xsh script which simply calls query. The source of the script is

%%
# list
if [ $# -eq 0 ] ; then
:query -q 'collection()/base-uri()'
elif [ "$1" = "-r" ] ; then
shift ;
for dir in $* ; do
:query -q <{{
declare variable $dir external;
for $d in xdmp:directory($dir,"infinity")/base-uri()
order by $d
return $d

}}> -v dir $dir
done

else
for dir in $* ; do
:query -q <{{
declare variable $dir external;
for $d in xdmp:directory($dir)/base-uri()
order by $d
return $d
}}> -v dir $dir
done

fi

%%

To list directories in a directory see [[MarkLogicListdir listdir]]




----
[[ModuleMarkLogic MarkLogic Extension Module]]

Valid XHTML :: Valid CSS: :: Powered by WikkaWiki