Skip to content

Commit 2d37700

Browse files
committed
fix
1 parent acf8309 commit 2d37700

4 files changed

Lines changed: 26 additions & 30 deletions

File tree

composer.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Database/Adapter/Mongo.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ public function getDocument(Document $collection, string $id, array $queries = [
12091209
$document = $this->castingAfter($collection, $document);
12101210

12111211
// Ensure missing relationship attributes are set to null (MongoDB doesn't store null fields)
1212-
if (!empty($projections)) {
1212+
if (empty($projections)) {
12131213
$this->ensureRelationshipDefaults($collection, $document);
12141214
}
12151215

@@ -2215,7 +2215,7 @@ public function find(
22152215
}
22162216

22172217
// Ensure missing relationship attributes are set to null (MongoDB doesn't store null fields)
2218-
if (!empty($projections)) {
2218+
if (empty($projections)) {
22192219
foreach ($found as $document) {
22202220
$this->ensureRelationshipDefaults($collection, $document);
22212221
}
@@ -2311,15 +2311,10 @@ public function count(QueryContext $context, ?int $max, array $filters, array $j
23112311
// Escape query attribute names that contain dots and match collection attributes
23122312
$this->escapeQueryAttributes($collection, $filters);
23132313

2314-
$filters = [];
23152314
$options = [];
23162315

23172316
if (!\is_null($max) && $max > 0) {
2318-
$options['limit'] = $max;
2319-
}
2320-
2321-
if ($this->timeout) {
2322-
$options['maxTimeMS'] = $this->timeout;
2317+
//$options['limit'] = $max; todo: Remove if not needed
23232318
}
23242319

23252320
// Build filters from queries
@@ -2362,14 +2357,14 @@ public function count(QueryContext $context, ?int $max, array $filters, array $j
23622357
}
23632358

23642359
// Add limit stage if specified
2365-
if (!\is_null($max)) {
2360+
if (!\is_null($max) && $max > 0) {
23662361
$pipeline[] = ['$limit' => $max];
23672362
}
23682363

23692364
// Use $group and $sum when limit is specified, $count when no limit
23702365
// Note: $count stage doesn't works well with $limit in the same pipeline
23712366
// When limit is specified, we need to use $group + $sum to count the limited documents
2372-
if (!\is_null($max)) {
2367+
if (!\is_null($max) && $max > 0) {
23732368
// When limit is specified, use $group and $sum to count limited documents
23742369
$pipeline[] = [
23752370
'$group' => [

src/Database/Validator/Query/Filter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
//
34
//namespace Utopia\Database\Validator\Query;
45
//

tests/e2e/Adapter/Base.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@
2424

2525
abstract class Base extends TestCase
2626
{
27-
use JoinsTests;
28-
use CollectionTests;
29-
use CustomDocumentTypeTests;
30-
use DocumentTests;
31-
use AttributeTests;
32-
use IndexTests;
33-
use OperatorTests;
34-
use PermissionTests;
27+
// use JoinsTests;
28+
// use CollectionTests;
29+
// use CustomDocumentTypeTests;
30+
// use DocumentTests;
31+
// use AttributeTests;
32+
// use IndexTests;
33+
// use OperatorTests;
34+
// use PermissionTests;
3535
use RelationshipTests;
36-
use SpatialTests;
37-
use SchemalessTests;
38-
use ObjectAttributeTests;
39-
use VectorTests;
40-
use GeneralTests;
36+
// use SpatialTests;
37+
// use SchemalessTests;
38+
// use ObjectAttributeTests;
39+
// use VectorTests;
40+
// use GeneralTests;
4141

4242
protected static string $namespace;
4343

0 commit comments

Comments
 (0)