Skip to content

Commit

Permalink
Fix to allow $meta projections
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyjb committed Apr 29, 2018
1 parent d7af37d commit ace3a7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion mongoframes/frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,11 +638,17 @@ def _flatten_projection(cls, projection):
inclusive = True
for key, value in deepcopy(projection).items():
if isinstance(value, dict):
# Check for $meta projections
if '$meta' in value:
flat_projection[key] = value
continue

# Store a reference/sub-frame projection
if '$ref' in value:
references[key] = value
elif '$sub' in value or '$sub.' in value:
subs[key] = value

flat_projection[key] = True

elif key == '$ref':
Expand Down Expand Up @@ -785,4 +791,4 @@ def _apply_projection(cls, documents, projection):

# Add sub-frames to the documents (if required)
if subs:
Frame._apply_sub_frames(documents, subs)
Frame._apply_sub_frames(documents, subs)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='1.2.10',
version='1.2.11',

description='A fast unobtrusive MongoDB ODM for Python',
long_description=long_description,
Expand Down

0 comments on commit ace3a7f

Please sign in to comment.