Skip to content
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

Aggregation framework $project does not work on fields within nested documents #397

Closed
boxmansf opened this issue Jun 20, 2018 · 3 comments
Labels
enhancement Reporting a feature that is missing from mongomock.

Comments

@boxmansf
Copy link

When using {'$projection' : {'doc_field.subfield': 1}} in an aggregation pipeline, this doesn't work:
File ".../lib/python2.7/site-packages/mongomock/collection.py", line 1627, in aggregate
out_collection = _extend_collection(out_collection, field, value)
File ".../lib/python2.7/site-packages/mongomock/collection.py", line 1506, in _extend_collection
doc[field] = _parse_expression(expression.copy(), doc)
AttributeError: 'int' object has no attribute 'copy'

@adrianocanofre
Copy link

I have the same problem when using aggregate

@pcorpet pcorpet changed the title Aggregation framework $projection does not work on fields within nested documents Aggregation framework $projec does not work on fields within nested documents Aug 11, 2018
@pcorpet pcorpet changed the title Aggregation framework $projec does not work on fields within nested documents Aggregation framework $project does not work on fields within nested documents Aug 11, 2018
@pcorpet
Copy link
Member

pcorpet commented Aug 11, 2018

I think you are both writing about the same feature: subfields in $project. It is indeed unsupported yet, however the error should be clearer about it. I've worked on a first fix to give the right exception, and might follow up with the actual solution.

pcorpet added a commit that referenced this issue Aug 12, 2018
Mark the subfield projection feature as not implemented yet. For #397.
@pcorpet pcorpet added the enhancement Reporting a feature that is missing from mongomock. label Aug 22, 2018
pcorpet added a commit to pcorpet/mongomock that referenced this issue Nov 28, 2018
pcorpet added a commit to pcorpet/mongomock that referenced this issue Nov 29, 2018
@pcorpet
Copy link
Member

pcorpet commented Nov 29, 2018

@boxmansf Please review #475.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Reporting a feature that is missing from mongomock.
Projects
None yet
Development

No branches or pull requests

3 participants