Tuesday 14 September 2021

ArangoDB: AQL: Update documents

Syntax

UPDATE id_or_key WITH document IN collection

 

Example

UPDATE "41308" WITH {"firstName" : "Ram", "age" : 31} IN users

 

127.0.0.1:8529@abc_org> db.users.document("41308")
{ 
  "_key" : "41308", 
  "_id" : "users/41308", 
  "_rev" : "_cSAxcHm---", 
  "id" : 1, 
  "firstName" : "Krishna", 
  "lastName" : "Gurram" 
}

127.0.0.1:8529@abc_org> db._query(`UPDATE "41308" WITH {"firstName" : "Ram", "age" : 31} IN users`)
[object ArangoQueryCursor, count: 0, cached: false, hasMore: false]

127.0.0.1:8529@abc_org> db.users.document("41308")
{ 
  "_key" : "41308", 
  "_id" : "users/41308", 
  "_rev" : "_cSBOj8u---", 
  "id" : 1, 
  "firstName" : "Ram", 
  "lastName" : "Gurram", 
  "age" : 31 
}

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment