0

As mentioned here, PHP's Mongo extension/driver is now deprecated, and the new counterpart is MongoDB driver, which has a related PHP library named PHPLib.

Now the old Mongo extension had MongoCursor.skip() and MongoCursor.limit() functions. I could use them for pagination.

But now, apparently the new MongoDB's (or the related library's) cursor does not have skip() or limit() functions. To know how I found out that, see my SO question.

My question is that, what are the alternatives of skip() and limit() functions (for implementing pagination) then?

JBel
  • 329
  • 1
  • 5
  • 19

1 Answers1

0

Use it as options of Query constructor:

$filter = [];
$options = [
    'limit' => //integer,
    'skip' => //integer
];

$query = new MongoDB\Driver\Query($filter, $options);

[Edit]

I just answer your other question.

Alberto Favaro
  • 1,824
  • 3
  • 21
  • 46