hasUpvoted = (user, document) => {
  // note(apollo): check upvoters depending if the document is queried by mongo directly or fetched by an apollo resolver
  return user && document.upvoters && !!document.upvoters.find(u => u && (typeof u === 'string' ? u === user._id : u._id === user._id));
}
@summary Check if a user has upvoted a document
@param {Object} user
@param {Object} document
@returns {Boolean}