Skip to content

Conversation

@deignacio
Copy link

As pointed out in #492 (comment) FileField and ImageField deletion breaks in EmbeddedDocuments. This set of patches build on pull request 492 to recurse through the fields of an EmbeddedDocument to do the appropriate deletion there as well.

David Ignacio added 3 commits May 10, 2012 00:47
Turns out DocumentMetaclass was the wrong place for this logic since
EmbeddedDocuments did not have the same rights as regular Documents.
This patch moves the logic to TopLevelDocumentMetaclass, and forces
the proxied field detection to recurse through embedded document fields.
@rozza
Copy link

rozza commented May 10, 2012

Great patch, however, I think we might want to clean / abstract this more. The FileField could theoretically be n levels down or in a ListField, so potentially we have to recurse and if thats the case it would be good to have a cleaner more performant way of doing it, as most documents wont have FileFields.

I probably rushed in the initial implementation, I think we should revisit the approach as there must be a cleaner way to deal with this and possibly drop_collection, potentially storing meta data in the fs.files collection.

@rozza
Copy link

rozza commented May 14, 2012

Ok I'm going to revert the previous .delete() patch on the document and mark this as wont fix.

I will open a new ticket to improve / drop_collection, document.delete() and Doc.objects.delete() all in one go. That will be done for 0.7

@rozza
Copy link

rozza commented May 14, 2012

See MongoEngine#18

@rozza rozza closed this May 14, 2012
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.

2 participants