我正在尝试在
gremlin.createClient
贬值后重写一些代码,但它需要以之前预期的方式返回数据。
const gremlin = require('gremlin');
client = new gremlin.driver.Client(`wss://${endpoint}:8182/gremlin`, {
mimeType: 'application/json', // this seems to change how the data is returned
});
const result = await client.submit(query, {});
我得到了这样的结果
{
"_items": [
1795207
],
"attributes": {},
"length": 1
}
而我需要类似的东西
[
{
"@type": "g:Int64",
"@value": 1795207
}
]
长话短说:不要明确指出或使用 mimeType
application/vnd.gremlin-v3.0+json
更多细节: Gremlin 服务器上有多个序列化器,具体取决于服务器版本和服务器设置。可能在您的情况下,一些非类型化序列化器在输入序列化器之前注册,因此处理请求