-
Notifications
You must be signed in to change notification settings - Fork 26
fix projection of refs in foreign collections #99
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
fix projection of refs in foreign collections #99
Conversation
django_mongodb/compiler.py
Outdated
|
||
# Unwrap Ref (in this part of the pipeline we can't do references over $projected fields). | ||
expr_ = expr | ||
while isinstance(expr_, Ref): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know if there could be a ref of refs. (it could, but Django creates it?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we've triaged pretty much all of the complicated queries by now, so if there's no test for it, I wouldn't worry about it.
Can any of this be separate commits? It's a best practice not to mix non-behavior change refactors with bug fixes. For example, reclassifying test_ticket_24605 shouldn't be mixed in with other work. Edit: test categorization done in #100. |
django_mongodb/compiler.py
Outdated
@@ -34,12 +34,19 @@ def __init__(self, *args, **kwargs): | |||
def _get_group_alias_column(self, expr, annotation_group_idx): | |||
"""Generate a dummy field for use in the ids fields in $group.""" | |||
replacement = None | |||
if isinstance(expr, Col): | |||
col = expr | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My general rule is not to include blank lines when you have a comment separating a logical section. And if you feel like you need a blank line, add a comment instead.
This could be split into two commits or three if the last one is the features, I think. However, the refactor of project method and the fix for the incorrect references must go together. |
e9b7484
to
243934f
Compare
The
to
|
|
76b6b4e
to
593917e
Compare
593917e
to
d9488a1
Compare
Handle refs from foreign collections.