I want to connect into the cosmos graph db in NodeJs. The implemented sample is coming from documentation. I've changed the example to connect into the emulator like the following:
var Gremlin = require("gremlin-secure");
const client = Gremlin.createClient(
8081,
"localhost", // or 127.0.0.1
{
"session": false,
"ssl": false,
"user": "/dbs/graphdb/colls/graphcollz",
"password": "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
});
console.log('Running Drop');
client.on('error', (err) => {
console.log(err.message);
});
I should mention that in the above documentation mentioned that:
The Gremlin endpoint must be only the host name without the protocol/port number, like mygraphdb.graphs.azure.com (not https://mygraphdb.graphs.azure.com or mygraphdb.graphs.azure.com:433).
Hence, the endpoint address for db is localhost
without any protocol/port.
Also, ssl is set to false
to prevent "self signed certificate" error, and graphdb and graphcollz were created before in emulator.
In this way, I've gotten the following error when try to execute the following query:
client.execute('g.V().drop()', {}, (err, results) => {
if (err) return console.error(err);
console.log(results);
});
The error is:
read ECONNRESET
Also, Node js ECONNRESET post cannot help to solve the problem to connect into the emulator.
Now, the question is how can I connect into the cosmos graph db emulator through the NodeJS?