docs: def insert(self, document):
          """
          Inserts a document into this collection. If a document already has an '_id'
          value it will be updated
  
          :returns: inserted document with id
          """
          if '_id' in document:
              return self.update(document)
  
          # Create it and return a modified one with the id
          cursor = self.db.execute("""
              insert into %s(data) values (?)
          """ % self.name, (json.dumps(document),))
  
          document['_id'] = cursor.lastrowid
          return document