Discussion:
[arangodb-google] Insert with custom assigned value
Dilip Vamsi Moturi
2018-06-02 06:38:36 UTC
Permalink
LET key = "abc"INSERT {
key: 2
} INTO sample

RETURN NEW


I would like to insert {"abc" : 2} not {"key" : 2}
--
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.
Dharmateja Tummala
2018-06-02 07:04:44 UTC
Permalink
??
Post by Dilip Vamsi Moturi
LET key = "abc"INSERT {
key: 2
} INTO sample
RETURN NEW
I would like to insert {"abc" : 2} not {"key" : 2}
--
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
For more options, visit https://groups.google.com/d/optout.
--
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.
Dilip Vamsi Moturi
2018-06-02 10:21:46 UTC
Permalink
LET concepts = [
{"cid": "546463", "is_dominant": true},
{"cid": "546465", "is_dominant": false}
]

LET update_suffix = "ul_"
LET uid = "32424"

FOR concept in concepts
LET cid = concept.cid
LET update_key = CONCAT(update_suffix, concept.is_dominant ? "D" : "ND")
LET doc_key = CONCAT(uid, "!", cid)
RETURN {
update_key: 1,
doc_key: concept.is_dominant
}


For this scenario I want the return value as

[
{
"ul_D": 1,
"32424!546463": true
},
{
"ul_ND": 1,
"32424!546465": false
}
]



Thanks,
Dilip Vamsi.
Post by Dilip Vamsi Moturi
LET key = "abc"INSERT {
key: 2
} INTO sample
RETURN NEW
I would like to insert {"abc" : 2} not {"key" : 2}
arangod> q='let abc=2 INSERT { abc } IN ulf RETURN NEW' ; rv =
db._query(q); print(rv.toArray())
[
{
"_key" : "286903",
"_id" : "ulf/286903",
"_rev" : "_W57Q9n6--_",
"abc" : 2
}
]
--
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.
Continue reading on narkive:
Loading...