user7334600
user7334600

Reputation: 1

Using Marklogic 8 Query Console Javascript on Windows 7

I am just starting to work with Marklogic and I am running simple commands like xdmp.document.load to ingest a json file

declareUpdate();
xdmp.documentLoad("C:\Users\Documents\SemanticData\Recipies\Tofu-Soup.json",
    {
      "uri" : "/documents/tofu-soup.json",
      "permissions" : xdmp.defaultPermissions(),
      "collections" : ["soup", "vegetarian"],
      "encoding" : 'UTF-8'
    })

I receive the following error where the path name has had all the "\" directory separators removed.

[javascript] SVC-FILOPN: xdmp.documentLoad("C:UsersDocumentsSemanticDataRecipiesTofu-Soup.json", {uri:"/documents/tofu-soup.json", permissions:[], collections:["soup", "vegetarian"], ...}) -- File open error: open 'C:UsersDocumentsSemanticDataRecipiesTofu-Soup.json': No such file or directory

I cannot find anything in the functions guide to illuminate me.

Any ideas

Upvotes: 0

Views: 135

Answers (2)

Chakresh Sahu
Chakresh Sahu

Reputation: 321

You can run command in following way.

declareUpdate();
xdmp.documentLoad("C:\\Users\\Documents\\SemanticData\\Recipies\\Tofu-Soup.json",
    {
      "uri" : "/documents/tofu-soup.json",
      "permissions" : xdmp.defaultPermissions(),
      "collections" : ["soup", "vegetarian"],
      "encoding" : 'UTF-8'
    })

Upvotes: 1

grtjn
grtjn

Reputation: 20414

Use forward slash, or escape the backslash by doubling it. Backslash is an escape character in JavaScript strings.

HTH!

Upvotes: 2

Related Questions