def set_batch(self, data):
    
    """
    Store multiple documents
    
    Args

    data <dict> data to store, use document ids as keys

    Returns

    revs <dict> dictionary of new revisions indexed by document ids
    """

    # fetch existing documents to get current revisions
    rows = self.bucket.view("_all_docs", keys=data.keys(), include_docs=True)
    existing = {}
    for row in rows:
      key = row.id
      if key and not data[key].has_key("_rev"):
        data[key]["_rev"] = row.doc["_rev"]

    for id,item in data.items():
      data[id]["_id"] = id

    revs = {}
    for success, docid, rev_or_exc in self.bucket.update(data.values()):
      if not success and self.logger:
        self.logger.error("Document update conflict (batch) '%s', %s" % (docid, rev_or_exc))
      elif success:
        revs[docid] = rev_or_exc

    return revs
Store multiple documents
    
    Args

    data <dict> data to store, use document ids as keys

    Returns

    revs <dict> dictionary of new revisions indexed by document ids