ArangoDB:名称必须是非空的

ArangoDB: name must be non-empty

当我在浏览器中打开页面时,我得到:

{"id":"786938997027","name":"users","isSystem":false,"status":3,"type":2,"error":false,"code":200}

当我从代码发送请求时,我得到下一个输出:

Response: {"error":true,"code":400,"errorNum":1208,"errorMessage":"name must be non-empty"}

怎么了?

void foo()
{
    string url = "http://localhost:8529/_db/testdb/_api/collection/users"; 
    import std.experimental.logger;
    globalLogLevel(LogLevel.info);

    Json users;

    requestHTTP(url,
        (scope req) {
            req.method = HTTPMethod.POST; 
        },
        (scope res) {
            logInfo("Response: %s", res.bodyReader.readAllUTF8());
            users = res.bodyReader.readAllUTF8();
        }
    );
}

您需要使用@Colonel 三十二提到的 GET 类型的请求。所以删除这一行:

req.method = HTTPMethod.POST;

或更改为:

req.method = HTTPMethod.GET;