Azure-cosmos-dotnet-v2: Error when setting a vertex property using a traversal

Created on 9 Aug 2018  路  6Comments  路  Source: Azure/azure-cosmos-dotnet-v2

In my early stages of Cosmos w/ Gremlin. I need to increment a vertex property, which I'd have thought to be trivial. I've seen examples w/ sack, and thought of using math, but Cosmos doesn't support either; so by playing around with Gremlin console I came up with this:

g.V(13).property('views', values('views').inject(1).sum())

However, that yields this error in the portal and in code (using Gremlin.net):

ExceptionType : GraphCompileException ExceptionMessage : Gremlin Query Compilation Error: 
Cannot create ValueField on non-primitive type GraphTraversal. Source : Microsoft.Azure.Graphs

I simplified it to this first line and still get the error, but the second line, using a constant, works.

g.V(13).property('views', values('views'))
g.V(13).property('views', 1)

... and all such variations, including union, select, etc. suffer the same fate. All of them work in Gremlin console, however. Is there another way I can do this in Cosmos? I'd prefer not to query for the value, increment in code, and set it again, not only for the additional query but also because it would be subject to race conditions.

Should this type of thing be supported, i.e., is it a bug or a known/planned limitation? If I'm just missing something, please let me know.

Thanks!

Most helpful comment

I did a few tests to find out what works:
https://pastebin.com/YYWh6R9H

I believe anything other than literals are not supported.

All 6 comments

I too would like an option for incrementing, preferably full math support. My team needs it for keeping track of counts of things without race-conditions and doing full queries.

We are having the exact same problem, and have not yet found any workarounds that allow us to read and increment a property in one query.

hi all, any updates?

I did a few tests to find out what works:
https://pastebin.com/YYWh6R9H

I believe anything other than literals are not supported.

Any update on this, it's been several months and it still doesn't work.

Hello all!
Sorry for the delay here, but this is the github repo for the SQL API .NET connectivity library. We recommend submitting all feature requests here: https://feedback.azure.com/forums/263030-azure-cosmos-db

Please tag them as Gremlin API

At this moment, we don't support non-scalar values as parameters, as @BenjaBobs mentioned. We are currently evaluating this feature and will provide an update soon.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RobertoPrevato picture RobertoPrevato  路  5Comments

rave1502 picture rave1502  路  4Comments

Lihan-Chen picture Lihan-Chen  路  6Comments

ChristopherHaws picture ChristopherHaws  路  4Comments

BenjaBobs picture BenjaBobs  路  6Comments