docs: function saveIndexInfo() {
  
      // reset the cache
      var tmpCache = cache.idxInfo;
      cache.idxInfo = {};
  
      var promises = [];
  
      // add promise for each things being saved/updated
      _.each(tmpCache, function (idxInfo, key) {
          var where = { str: key };
          var select = '_id count';
  
          var promise = IdxInfoModel.findOne(where, select).exec()
              .then(function (savedItem) {
                  if (savedItem) {
                      return IdxInfoModel.findOneAndUpdate(where, { $inc: { count: idxInfo.count }});
                  }
                  else {
                      var model = new IdxInfoModel(idxInfo);
                      var deferred = Q.defer();
                      model.save(function (modelErr) {
                          modelErr ? deferred.reject(modelErr) : deferred.resolve(model.toObject());
                      });
                      return deferred.promise;
                  }
              });
  
          promises.push(promise);
      });
  
      return Q.all(promises);
  }