From 0b22c140c5f17b80a1643ffead94ccd4d7af0992 Mon Sep 17 00:00:00 2001 From: Andrey Fedoseev Date: Tue, 22 May 2012 22:31:59 +0600 Subject: [PATCH] Add sensible __eq__ method to EmbeddedDocument --- mongoengine/document.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mongoengine/document.py b/mongoengine/document.py index 95b07d1b..bb079c99 100644 --- a/mongoengine/document.py +++ b/mongoengine/document.py @@ -40,6 +40,11 @@ class EmbeddedDocument(BaseDocument): else: super(EmbeddedDocument, self).__delattr__(*args, **kwargs) + def __eq__(self, other): + if isinstance(other, self.__class__): + return self._data == other._data + return False + class Document(BaseDocument): """The base class used for defining the structure and properties of