Skip to content

Commit

Permalink
Fix projection in MongoDB 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vtomasr5 committed Nov 24, 2023
1 parent 9e5e0d3 commit 9b41316
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/document/test_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,16 @@ class Test(Document):
)

PROJECTION_STR = "PROJECTION" if mongo_db < MONGODB_42 else "PROJECTION_COVERED"
assert (
query_plan.get("queryPlanner").get("winningPlan").get("stage")
== PROJECTION_STR
)
if mongo_db < MONGODB_70:
assert (
query_plan.get("queryPlanner").get("winningPlan").get("stage")
== PROJECTION_STR
)
else:
assert (
query_plan.get("queryPlanner").get("winningPlan").get("queryPlan").get("stage")
== PROJECTION_STR
)

query_plan = Test.objects(a=1).explain()
assert (
Expand Down

0 comments on commit 9b41316

Please sign in to comment.