Md Eftakhairul Islam
Md Eftakhairul Islam

Reputation: 198

OriendDB Pegination in Nodejs

What is the best way to set offset and limit for pagination in Nodejs with oriento or orientjs npm library? I fetched some vertexs by query builder as follow:

db.select()
  .from('some_class')
  .limit(20)
  .all()
  .then(function (results) {
    cb(results);
  });

here, I can put limit but how to put offset? Either in query or query builder for pagination would be very helpful.

Upvotes: 1

Views: 141

Answers (1)

Lvca
Lvca

Reputation: 9060

Use the skip(). To get the second page in your example:

db.select()
  .from('some_class')
  .skip(20)
  .limit(20)
  .all()
  .then(function (results) {
    cb(results);
 });

Upvotes: 3

Related Questions