Due to join projections we often do not know the guids of the related docs yet, and even sometimes the type as well
function getWorkflowGuids(callback) {
        return self.apos.docs.db.findWithProjection(
          { _id: { $in: _.pluck(related, '_id') } },
          { _id: 1, workflowGuid: 1, type: 1 }
        ).toArray(function(err, guidDocs) {
          if (err) {
            return fail(err);
          }
          _.each(guidDocs, function(guidDoc) {
            var relatedOne = _.find(related, { _id: guidDoc._id });
            if (relatedOne) {
              relatedOne.workflowGuid = guidDoc.workflowGuid;
              idsByGuid[relatedOne.workflowGuid] = relatedOne._id;
              relatedOne.type = guidDoc.type;
            }
          });
          // Discard unless the type is known, the type is subject to
          // workflow and we have the workflowGuid
          related = _.filter(related, function(relatedOne) {
            return relatedOne.type && relatedOne.workflowGuid && self.includeType(relatedOne.type);
          });
          return callback(null);
        });
      }