Fix list document total
This commit is contained in:
parent
a91ee7e80f
commit
e123188b0a
1 changed files with 6 additions and 1 deletions
|
@ -2910,7 +2910,8 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents')
|
||||||
|
|
||||||
$documentSecurity = $collection->getAttribute('documentSecurity', false);
|
$documentSecurity = $collection->getAttribute('documentSecurity', false);
|
||||||
$validator = new Authorization(Database::PERMISSION_READ);
|
$validator = new Authorization(Database::PERMISSION_READ);
|
||||||
if (!$validator->isValid($collection->getRead())) {
|
$valid = $validator->isValid($collection->getRead());
|
||||||
|
if (!$valid) {
|
||||||
$total = $documentSecurity
|
$total = $documentSecurity
|
||||||
? $dbForProject->count('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $filterQueries, APP_LIMIT_COUNT)
|
? $dbForProject->count('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $filterQueries, APP_LIMIT_COUNT)
|
||||||
: 0;
|
: 0;
|
||||||
|
@ -2979,6 +2980,10 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents')
|
||||||
foreach ($documents as $index => $document) {
|
foreach ($documents as $index => $document) {
|
||||||
if (!$processDocument($collection, $document)) {
|
if (!$processDocument($collection, $document)) {
|
||||||
unset($documents[$index]);
|
unset($documents[$index]);
|
||||||
|
|
||||||
|
if ($valid) {
|
||||||
|
$total--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue