Discussion:
[arangodb-google] Updation of nested document
d***@nextsteps.ai
2018-06-01 12:54:32 UTC
Permalink
LET doc = DOCUMENT("MoodAnalysis/32424!546463")
RETURN (
IS_NULL(doc) ? (
INSERT
{
"metrics": {
"hello" : {
"ul_D": 1,
"hl_D": 0
}
},
"uid": 32424,
"cid": 546463,
"_key": "32424!546463"
}
INTO MoodAnalysis RETURN NEW
) : (
HAS(doc.metrics, "hello") ? (
UPDATE "MoodAnalysis/32424!546463" with {
"metrics": {
"hello": {
"ul_D": doc.metrics["hello"]["ul_D"] + 1
}
}
}
in MoodAnalysis RETURN NEW
) : (
UPDATE "MoodAnalysis/32424!546463" with {
"metrics": {
"hello": {
"ul_D": 1,
"hl_D": 0
}
}
}
in MoodAnalysis RETURN NEW
)
)
)

I would like to insert a document if it doesn't exist.
If the document exists then I would like to update the "hello" metrics if
it exists or add a new.

I'm getting the following error
Query: AQL: access after data-modification by collection 'MoodAnalysis'
(while optimizing ast)
--
You received this message because you are subscribed to the Google Groups "ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to arangodb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...