Neptune DB 不会将属性值更改为以前的值



我在使用AWS Neptune DB时有一个非常奇怪的问题。我只能将属性更改为新值,不能使用任何以前的名称。
我使用gremlin和node.js。
听起来很奇怪,所以让我添加一些代码:

const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection;
const dc = new DriverRemoteConnection(process.env.DB_URL, { authenticator, connectOnStartup: false });
await dc.open();
const g = gremlin.process.AnonymousTraversalSource.traversal().withRemote(dc);
await g.V().hasLabel('Wtf').drop().iterate();
await g.addV('Wtf').property('test', 'foo').iterate()
await g.V().hasLabel('Wtf').property('test', 'bar foo').iterate();
await g.V().hasLabel('Wtf').property('test', 'foo').iterate();
const wtf = await g.V().hasLabel('Wtf').elementMap().toList();
console.log(wtf);

所以我想我应该有这样的响应:

Map(3) {
EnumValue { typeName: 'T', elementName: 'id' } => '7cbdd4d6-9d72-905f-c4b1-0ee9a31db29a',
EnumValue { typeName: 'T', elementName: 'label' } => 'Wtf',
'test' => 'foo'
}

但是我有:

Map(3) {
EnumValue { typeName: 'T', elementName: 'id' } => '7cbdd4d6-9d72-905f-c4b1-0ee9a31db29a',
EnumValue { typeName: 'T', elementName: 'label' } => 'Wtf',
'test' => 'bar foo'
}

有趣的是,如果我使用任何一个单词(没有空格)代替bar foo,我有正确的结果。当我一个接一个地查询数据库时,我也有同样的问题。有人看到这个问题了吗?你知道怎么解吗?

Neptune默认使用Set基数。每次添加一个值时,您都在扩展该Set,因为您没有显式地使用Cardinality.single。此外,elementMap将只返回Set cardinality属性的一个元素。看到他们都使用valueMap代替。

最新更新