Wednesday 15 September 2021

ArangoDB: AQL: Replace entire document

Syntax

REPLACE id_or_key WITH document IN collection

 

Example

REPLACE "41308" WITH {"firstName" : "Gopi", "country": "India"} IN users

 

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 
}

127.0.0.1:8529@abc_org> 
127.0.0.1:8529@abc_org> db._query(`REPLACE "41308" WITH {"firstName" : "Gopi", "country": "India"} 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" : "_cSBTpJC---", 
  "country" : "India", 
  "firstName" : "Gopi" 
}

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment