Skip to content

allow QuerySet.count() to query multiple collections #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 16, 2024

Conversation

timgraham
Copy link
Collaborator

No description provided.

@timgraham timgraham force-pushed the count-use-aggregate branch from b6d1427 to c6da98f Compare July 11, 2024 19:09
@timgraham timgraham requested a review from WaVEV July 11, 2024 19:34
@WaVEV
Copy link
Collaborator

WaVEV commented Jul 12, 2024

I have been working on a similar task, specifically because the aggregate includes count. In my opinion, it is ok to merge this code, even though the majority of it will likely be moved or replaced.

Copy link
Collaborator

@WaVEV WaVEV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor thing: Solve the TODO

@timgraham
Copy link
Collaborator Author

The todo is because there's a corresponding patch to the Django fork that I'll merge in advance of this one:

diff --git a/tests/lookup/tests.py b/tests/lookup/tests.py
index a198a13b62..aa4ed46b98 100644
--- a/tests/lookup/tests.py
+++ b/tests/lookup/tests.py
@@ -1112,6 +1112,10 @@ class LookupTests(TestCase):
         self.assertEqual(Game.objects.filter(season__gt__in=[222, 333]).count(), 5)
         self.assertEqual(Game.objects.filter(season__gt__gt=111).count(), 5)
 
+    def test_lookup_collision_distinct(self):
+        # These were separated from the above test because distinct() isn't
+        # supported.
+
         # Players who played in 2009
         self.assertEqual(
   

I don't want to merge that until this is approved since it would cause other builds to fail in the meantime.

@timgraham timgraham requested a review from WaVEV July 15, 2024 15:16
@timgraham timgraham force-pushed the count-use-aggregate branch from c6da98f to 9bd5b59 Compare July 16, 2024 14:38
@timgraham timgraham merged commit 9bd5b59 into mongodb:main Jul 16, 2024
3 checks passed
@timgraham timgraham deleted the count-use-aggregate branch July 16, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants