I have a Gremlin API Cosmos DB. In the DB I have one type of Vertice with Label User
that are connected to Vertices labeled Companies
. I then want to show all connected companies. I do the query g.V('id-of-User').outE()
and gets all connected Companies. The result might look something like this:
[
{
"id": "08f97a1d-9e81-4ccc-a498-90eb502b1879",
"label": "AuthorizedSignatory",
"type": "edge",
"inVLabel": "Company",
"outVLabel": "User",
"inV": "abd51134-1524-44fe-8a49-60d2d449a1f3",
"outV": "103bf1b9-464f-4f68-a4ca-7dfdbe94ae84"
},
{
"id": "c36b640b-9574-403b-8ab6-fcce695caa90",
"label": "AuthorizedSignatory",
"type": "edge",
"inVLabel": "Company",
"outVLabel": "User",
"inV": "2c14d279-00a4-41ad-a8c0-f3b882864568",
"outV": "103bf1b9-464f-4f68-a4ca-7dfdbe94ae84"
}
]
This is absolutely as expected. Now I want to take this a bit further and instead of just showing the GUID in the inV parameter I also want to include the Company Name in the result object, but I do not understand how to do the equivalent to a SQL join here.
Can someone please help me!!
What I want is something similar to the example below:
[
{
"id": "08f97a1d-9e81-4ccc-a498-90eb502b1879",
"label": "AuthorizedSignatory",
"type": "edge",
"inVLabel": "Company",
"outVLabel": "User",
"inV": "abd51134-1524-44fe-8a49-60d2d449a1f3",
"outV": "103bf1b9-464f-4f68-a4ca-7dfdbe94ae84",
"CompanyName": "ACME CORP"
},
{
"id": "c36b640b-9574-403b-8ab6-fcce695caa90",
"label": "AuthorizedSignatory",
"type": "edge",
"inVLabel": "Company",
"outVLabel": "User",
"inV": "2c14d279-00a4-41ad-a8c0-f3b882864568",
"outV": "103bf1b9-464f-4f68-a4ca-7dfdbe94ae84",
"CompanyName": "Giganticorp"
}
]
Where the CompanyName
is one of the properties in the Company Vertice with the guid in inV
prop.