-
Notifications
You must be signed in to change notification settings - Fork 266
Closed
Labels
Description
This one has me baffled. We've spent about 6 hours today trying to understand what we're doing wrong when using limit.
The following code works and returns 4 documents. For this particularly find there are only 4 documents that would ever match:
$filter = [
'cancel_reason' => null,
'financial_status' => ['$ne' => 'pending'],
'tags' => new MongoDB\BSON\Regex("kiosk", 'i'),
'created_at' => ['$gte' => '2016-03-01T03:00:00-04:00', '$lte' => '2016-04-01T02:59:59-04:00'],
'$or' => [
[
'tags' => new MongoDB\BSON\Regex("Fort Belvoir VA", 'i')
]
]
];
$options['skip'] = 0;
$options['limit'] = 4;
$cursor = $collection->find($filter, $options);
If I change limit to 3 like below, no documents are returned the script hangs and then dies with zero php errors and no exceptions being thrown:
$options['limit'] = 3;