Monday, 9 August 2021

ArangoDB: skip(): skip number of documents

‘skip(n)’ method is used to skip ‘n’ number of documents.

 

Example

127.0.0.1:8529@abc_org> db.user.all().toArray()
[ 
  { 
    "_key" : "15750", 
    "_id" : "user/15750", 
    "_rev" : "_cReWUTe---", 
    "id" : 1, 
    "name" : "Sailu" 
  }, 
  { 
    "_key" : "15758", 
    "_id" : "user/15758", 
    "_rev" : "_cReWbIK---", 
    "id" : 2, 
    "name" : "Ram" 
  }, 
  { 
    "_key" : "15766", 
    "_id" : "user/15766", 
    "_rev" : "_cReWhcu---", 
    "id" : 3, 
    "name" : "Gopi" 
  }, 
  { 
    "_key" : "15774", 
    "_id" : "user/15774", 
    "_rev" : "_cReWo3e---", 
    "id" : 4, 
    "name" : "Joel" 
  } 
]

 

As you above snippet user Collection has 4 documents in it. Let’s skip the first 2 documents.

127.0.0.1:8529@abc_org> db.user.all().skip(2).toArray()
[ 
  { 
    "_key" : "15766", 
    "_id" : "user/15766", 
    "_rev" : "_cReWhcu---", 
    "id" : 3, 
    "name" : "Gopi" 
  }, 
  { 
    "_key" : "15774", 
    "_id" : "user/15774", 
    "_rev" : "_cReWo3e---", 
    "id" : 4, 
    "name" : "Joel" 
  } 
]

 


 

Previous                                                    Next                                                    Home

No comments:

Post a Comment