Fixed document equality: documents in different collections can have equal ids.

This commit is contained in:
tprimozi
2014-02-13 18:12:33 +00:00
parent c5c7378c63
commit 0523c2ea4b
2 changed files with 43 additions and 9 deletions

View File

@@ -216,7 +216,7 @@ class BaseDocument(object):
if isinstance(other, self.__class__) and hasattr(other, 'id'):
return self.id == other.id
if isinstance(other, DBRef):
return self.id == other.id
return self._get_collection_name() == other.collection and self.id == other.id
return False
def __ne__(self, other):