code: function getObjectIdFromRefField (val) {
  
      let oid = linz.mongoose.Types.ObjectId;
  
      // Determine if we have an ObjectId or an Object with an ObjectId in it.
      // { type: 'modelName': _id: ObjectID() }
      // If `val` exists, `val` itself is not an instance of ObjectId,
      // `val._id` exists, and `val._id` is an instance of ObjectId.
      if (val && !(val instanceof oid) && val._id && val._id instanceof oid) {
          return val._id;
      }
  
      return val;
  
  }
docs: Get the ObjectId from the two types of reference fields that Linz supports:
  
  bdm: {
  type: linz.mongoose.Schema.Types.ObjectId,
  ref: 'mmsUser'
  },
  createdBy: {
  type: linz.mongoose.Schema.Types.Mixed,
  ref: 'mmsUser'
  }
  
  If can ObjectId can't be found, simply return the original value;
  
  @param  {Object} val Either an instance of ObjectId or { type: 'modelName', _id: ObjectID() }
  @return {Object}     Return either an ObjectID or the original value.