Reputation: 1205
I tried to use marklogic webUI console on port 8000 and Xquery. I tried the code bellow to retrieve a document by URI and display all fields:
xdmp:document-get("/XXX/YYYY.json")
NOTE :this code is executed on the API port 9033 (custom API)
Unfortunately, I have the following error :
File open error: open '/XXX/YYYY.json': No such file or directory
If I use the custom API port 9033 (the same as in the console), I can retrieve my document without any error :
https://<mydomain>:9033/v1/documents?uri=/XXX/YYYY.json&category=metadata
Any idea ?
Thanks, Romain.
Upvotes: 0
Views: 310
Reputation: 86
Romain- Use fn:doc() with the console content-source drop-down set to the database where your document is.
xdmp:document-get is good for files outside the database. From the docs at docs.marklogic.com, on the $location parameter:
The location of the input document. If the scheme of the location is HTTP (that is, if the string starts with "http://"), then the document is requested over HTTP. If the scheme is file (that is, if the string starts with "file://"), then the document is requested over file protocol from the local filesystem. Otherwise, the document is fetched from the local filesystem. On the filesystem, the path can be fully qualifed or relative. Relative pathnames are resolved from the directory in which MarkLogic Server is installed.
Upvotes: 1
Reputation: 793
First thought is that it would be better to use:
fn:doc("/XXX/YYYY.json")
Also make sure that the datasource is set to the appropriate database in the QueryConsole interface.
Upvotes: 4