Wednesday, 4 August 2021

ArangoDB: Traverse a cursor using next and hasNext methods

Using next(), hasNext() methods you can access the cursor elements.

 

Example

usersCursor = userCollection.all()

while(usersCursor.hasNext()) print(usersCursor.next())

127.0.0.1:8529@abc_org> usersCursor = userCollection.all()
SimpleQueryAll(user)

127.0.0.1:8529@abc_org> while(usersCursor.hasNext()) print(usersCursor.next())
{ 
  "_key" : "12977", 
  "_id" : "user/12977", 
  "_rev" : "_cRdSijO---", 
  "id" : 1, 
  "firstName" : "Ram" 
}
{ 
  "_key" : "13028", 
  "_id" : "user/13028", 
  "_rev" : "_cRdT1TK---", 
  "id" : 514, 
  "firstName" : "Sailu" 
}
{ 
  "_key" : "14390", 
  "_id" : "user/14390", 
  "_rev" : "_cRd12pm---", 
  "id" : 1, 
  "firstName" : "Ram" 
}
{ 
  "_key" : "14434", 
  "_id" : "user/14434", 
  "_rev" : "_cRd5IAm---", 
  "lastName" : "Battu", 
  "firstName" : "Ram" 
}

127.0.0.1:8529@abc_org>

 

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment