Open z0u opened 9 years ago
Works fine on master, you might also want to create eq
OK, thanks for that. So is it safe to override __eq__
for Document
and EmbeddedDocument
?
I don't see it a reason why it shouldn't be as long as you implement it correctly.
Usually you could check if self.id is not None and self is other
for saved objects.
For in memory (not saved) you could do whatever makes sense to your document.
Make sure your __eq__
works for both cases.
I'm basing my response in Django ORM model from which this is based on.
Hopefully someone can correct me if I'm wrong.
An embedded document that contains a
ReferenceField
can not be compared to another until it is saved.The last line throws this exception:
This is in mongoengine version 0.8.7, Python 2.7.6.