Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit ae9606b

Browse files
committed
PHPORM-50 Remove call to deprecated Collection::count for countDocuments
https://www.mongodb.com/docs/php-library/current/reference/method/MongoDBCollection-count/
1 parent 9d9c7c8 commit ae9606b

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
1010
- Throw an exception for unsupported `Query\Builder` methods [#9](https://github.com/GromNaN/laravel-mongodb-private/pull/9) by [@GromNaN](https://github.com/GromNaN).
1111
- Throw an exception when `Query\Builder::orderBy()` is used with invalid direction [#7](https://github.com/GromNaN/laravel-mongodb-private/pull/7) by [@GromNaN](https://github.com/GromNaN).
1212
- Throw an exception when `Query\Builder::push()` is used incorrectly [#5](https://github.com/GromNaN/laravel-mongodb-private/pull/5) by [@GromNaN](https://github.com/GromNaN).
13+
- Remove call to deprecated `Collection::count` for `countDocuments` [#18](https://github.com/GromNaN/laravel-mongodb-private/pull/18) by [@GromNaN](https://github.com/GromNaN).
1314

1415
## [3.9.2] - 2022-09-01
1516

src/Query/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public function toMql(): array
273273
$aggregations = blank($this->aggregate['columns']) ? [] : $this->aggregate['columns'];
274274

275275
if (in_array('*', $aggregations) && $function == 'count') {
276-
return ['count' => [$wheres, []]];
276+
return ['countDocuments' => [$wheres, []]];
277277
} elseif ($function == 'count') {
278278
// Translate count into sum.
279279
$group['aggregate'] = ['$sum' => 1];

0 commit comments

Comments
 (0)