You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Andric LibreSinn (JIRA)" <ji...@apache.org> on 2019/03/21 20:01:00 UTC
[jira] [Created] (TINKERPOP-2184) Difficulty connecting to Gremlin
using the NodeJS implementation
Andric LibreSinn created TINKERPOP-2184:
-------------------------------------------
Summary: Difficulty connecting to Gremlin using the NodeJS implementation
Key: TINKERPOP-2184
URL: https://issues.apache.org/jira/browse/TINKERPOP-2184
Project: TinkerPop
Issue Type: Bug
Components: javascript
Affects Versions: 3.4.0
Reporter: Andric LibreSinn
We are trying to use the fluent API because [within your documentation|http://tinkerpop.apache.org/docs/current/reference/#_submitting_scripts_4] you recommend not using script based requests.
{noformat}
TinkerPop does not recommend submitting script-based requests and generally continues to support this feature for legacy reasons and corner use cases which are still not completely addressed by the Gremlin language. Please consider using bytecode-based requests instead when possible.{noformat}
That being said I can't seem to connect or I am connecting but I cannot query correctly. This is the current script-less code that I've put together.
{code:java}
const gremlin = require('gremlin');
const config = require('./config')
const Graph = gremlin.structure.Graph
const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection
const PlainTextSaslAuthenticator = gremlin.driver.auth.PlainTextSaslAuthenticator
const username = `/dbs/${config.database}/colls/${config.collection}`
const password = config.primaryKey
const options = {
authenticator: new PlainTextSaslAuthenticator(username, password),
endpoint: config.endpoint,
traversalsource: 'g',
rejectUnauthorized: true,
mimeType: 'application/vnd.gremlin-v3.0+json',
}
const graph = new Graph()
const connection = new DriverRemoteConnection(config.endpoint, options)
const g = graph.traversal().withRemote(connection)
const theWholePlate = async () => {
const names = await g.V('42f0da58-501b-4dfb-972d-abab025abdad')
console.log(names)
}
theWholePlate()
{code}
The output to `names` is
{noformat}
GraphTraversal {
graph: Graph {},
traversalStrategies: TraversalStrategies {
strategies: [[Object]]
},
bytecode: Bytecode {
sourceInstructions: [],
stepInstructions: [[Array]]
},
traversers: null,
sideEffects: null,
_traversalStrategiesPromise: null,
_traversersIteratorIndex: 0,
}{noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)