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

Provide property '_parent' for EmbeddedDocument #139

Closed
wants to merge 1 commit into from

Conversation

aclowes
Copy link

@aclowes aclowes commented Sep 25, 2012

It would be convenient to get the containing document when you have an embedded document. Here's an idea for how to do that. I find I want this sometime when I am passing the embedded document to a function but not the parent.

However, I think people might have a variety of reasons why this is not a good idea. Is this useful or a bad idea?

@unaxfromsibiria
Copy link

It is not often necessary, depending increase only, I think.

@aclowes
Copy link
Author

aclowes commented Sep 28, 2012

Ross, I think I will close this pull request for now - maybe revisit it later. I was trying to think through the best way to do this for list fields and didn't have a great solution, as I wouldn't want to iterate over a possibly very long list unnecessarily.

@aclowes aclowes closed this Sep 28, 2012
@rozza
Copy link
Contributor

rozza commented Sep 29, 2012

We should be able to do this because an embedded doc will become a BaseList
on introspection so we could use that

On Friday, September 28, 2012, aclowes wrote:

Ross, I think I will close this pull request for now - maybe revisit it
later. I was trying to think through the best way to do this for list
fields and didn't have a great solution, as I wouldn't want to iterate over
a possibly very long list unnecessarily.


Reply to this email directly or view it on GitHubhttps://github.com//pull/139#issuecomment-8981894.

@rozza rozza reopened this Oct 17, 2012
@rozza
Copy link
Contributor

rozza commented Oct 17, 2012

Reopening the ticket ...

rozza added a commit that referenced this pull request Nov 6, 2012
@rozza
Copy link
Contributor

rozza commented Nov 6, 2012

Have added an _instance attribute.

@rozza rozza closed this Nov 6, 2012
@rozza
Copy link
Contributor

rozza commented Nov 6, 2012

Will be released as apart of the 0.8 release

lexqt added a commit to lexqt/django-mongotools that referenced this pull request Nov 17, 2012
``parent_document`` argument is not obligatory anymore. It can be
automatically set if embedded doc has a parent reference
(MongoEngine/mongoengine#139).

Add basic support for ListField(EmbeddedDocumentField).
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.

3 participants