Hi Dan,


that is unfortunately a challenge with escaping. If you embed the path into 
the query string directly and use the arangosh, you need a lot of 
backslashes:


{ "action": "function () { var db = require('@arangodb').db; return 
db._query(\"FOR node IN TestCollection FILTER node.filePath == 
'C:\\\\\\\\temp\\\\\\\\a.txt' RETURN node\").toArray(); }", "collections": 
{ "read": ["TestCollection"] } }


You can also pass an optional parameter argument, which avoids this 
escaping:


arangosh [_system]> a = { "action": "function (params) { var db = 
require('@arangodb').db; return db._query(\"FOR node IN TestCollection 
FILTER node.filePath == @path RETURN node\", { path: params } ).toArray(); 
}", "collections": { "read": ["TestCollection"] }, params: 
'C:\\temp\\a.txt' }
{ 
  "action" : "function (params) { var db = require('@arangodb').db; return 
db._query(\"FOR node...", 
  "collections" : { 
    "read" : [ 
      "TestCollection" 
    ] 
  }, 
  "params" : "C:\\temp\\a.txt" 
}

arangosh [_system]> db._executeTransaction(a)
[ 
  { 
    "_id" : "TestCollection/39151872291", 
    "_key" : "39151872291", 
    "_rev" : "281830715", 
    "filePath" : "C:\\temp\\a.txt" 
  } 
]


Well, at least almost. You still need to enter it in the shell with two 
slashes.


best

  Frank

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to