def save(self, doc):
        if doc.id:
            return self.update(doc)
        else:
            return self.insert(doc)
def bufferedMode(self, mode = True):
        if mode is None:
            self.flush()
        self._bufferedMode = mode