Exception using client and trying to add vertices

113 views Asked by At

Steps in the code: 1.Declared Azure Cosmos DB Configuration variables(Host , PrimaryKey , Database ,Container) 2.Connection Pool 3.WebSocketConfiguration 4.GremlinServer

After all above steps, when I was using gremlin client and trying to add vertices getting below exception: using (var gremlinClient = new GremlinClient( gremlinServer, connectionPoolSettings: connectionPoolSettings, webSocketConfiguration: webSocketConfiguration)) {

          var g = Traversal().WithRemote(new DriverRemoteConnection(gremlinClient));
            var v1 = g.AddV("person").Property("name", "marko");
            var v2 = g.AddV("person").Property("name", "stephen");
            **g.AddV("Person").AddE("self").To(g.V(1));**

}

EXCEPTION : System.ArgumentException: 'The child traversal of Gremlin.Net.Process.Traversal.Bytecode was not spawned anonymously - use the __ class rather than a TraversalSource to construct the child traversal'

1

There are 1 answers

4
Kelvin Lawrence On

Instead of using to(g.V(1)) just use to(V(1)) or to(__.V(1)) .

The use of a g mid traversal was deprecated in the 3.5.x line of Apache TinkerPop and removed as part of the 3.6.0 launch.