在ArangoDB中使用TinkerPop创建顶点并索引自定义属性的解决方法如下所示:
arangosh> db._create("vertices");
arangosh> db.vertices.ensureIndex({ type: "hash", fields: ["customProperty"] });
GraphTraversalSource g = AnonymousTraversalSource.traversal().withRemote(DriverRemoteConnection.using("localhost", 8182, "g"));
GraphTraversal traversal = g.addV("vertexLabel").property("customProperty", "customValue");
traversal.next();
has
步骤来指定索引字段。GraphTraversalSource g = AnonymousTraversalSource.traversal().withRemote(DriverRemoteConnection.using("localhost", 8182, "g"));
GraphTraversal traversal = g.V().has("customProperty", "customValue");
Vertex vertex = traversal.next();
以上就是使用ArangoDB和TinkerPop创建顶点并索引自定义属性的解决方法。请根据您的具体需求进行相应的调整。