关于 arangodb 中的批量删除 API

Regarding bulk delete API in arangodb

我正在寻找 API 在 ArangoDB 中执行批量删除。我该怎么做?

下面的我已经看完了link...但是我觉得太乏味了。 https://docs.arangodb.com/HttpBatchRequest/index.html

实际上我正在寻找一些更简单的方法,比如批量导入语法(粘贴在下面供您参考)

curl --data-binary @- -X POST --dump - "http://localhost:8529/_api/import?collection=test&createCollection=true" [ "firstName", "lastName", "age", "gender" ] [ "Joe", "Public", 42, "male" ] [ "Jane", "Doe", 31, "female" ]

请在这方面帮助我。

提前致谢

您可以像这样使用 AQL 轻松地从集合中删除一堆项目:(就像您在 arangosh 中执行它一样,在术语中将使用 REST api)

db._query(`FOR item IN test FILTER item._key IN @listToDelete REMOVE item  IN test`,
          {listToDelete: ['key1', 'key2']})

正如我对“_key”属性所做的那样,您必须指定一个属性以再次匹配绑定值中的数组。

使用 ngrep or wireshark 您可以轻松地了解如何在没有驱动程序的情况下自行通过 REST 接口发送此类 AQL 查询:

POST /_db/_system/_api/cursor HTTP/1.1
Host: 127.0.0.1
Connection: Keep-Alive
User-Agent: ArangoDB
Accept-Encoding: deflate
Authorization: Basic xxxxx
Content-Length: 133

{"query":"FOR item IN test FILTER item._key IN @listToDelete REMOVE item  IN test","count":false,"bindVars":{"listToDelete":["840"]}}

T 127.0.0.1:8529 -> 127.0.0.1:39125 [AP]
HTTP/1.1 201 Created
Server: ArangoDB
Connection: Keep-Alive
Content-Type: application/json; charset=utf-8
Content-Length: 223

{"result":[],"hasMore":false,"cached":false,"extra":{"stats":{"writesExecuted":0,"writesIgnored":0,"scannedFull":0,"scannedIndex":0,"filtered":0,"executionTime":2.739429473876953e-4},"warnings":[]},"error":false,"code":201}