def save(self, doc):
        if doc.id:
            return self.update(doc)
        else:
            return self.insert(doc)
def __setitem__(self, key, value):
        self._collection[key] = self._from_python(key, value)