def save(self, doc):
        if doc.id:
            return self.update(doc)
        else:
            return self.insert(doc)
def items(self):
        for key, value in self._collection.items():
            yield key, self._to_python(value)