@Override
  public String getFieldPath(String fieldPath, int operation) {
    """
	This is used by destination which performs CRUD operations.
	Records sent from MongoOpLog origin have /o field that contains a map of
	key-value for INSERT and DELETE operation, but
	UPDATE record has /o2 field which contains _id and /o/$set field
	which contains a map of key-value to update.
	This method looks into the right field path for UPDATE so that
	users don't need a separate field-column mapping for UPDATE.
	@param fieldPath fieldPath in incoming record
	@param operation Crud operation code
	@return Actual field path in record
    """
    if (operation == OperationType.UPDATE_CODE) {
    if (fieldPath.contains(ID_FIELD)){
      // _id is stored in "/o2/column_name for update records. Need to change the fieldpath"
      return fieldPath.replace(OP_FIELD, OP2_FIELD);
    } else {
      // column and values are stored in "/o/$set/column_name". Need to change the fieldpath
      return fieldPath.replaceFirst(OP_FIELD, String.format("%s/%s", OP_FIELD, SET_FIELD));
    }
  }
    return fieldPath;
  }
@Override
  public String getFieldPath(String fieldPath, int operation) {
    if (operation == OperationType.UPDATE_CODE) {
    if (fieldPath.contains(ID_FIELD)){
      // _id is stored in "/o2/column_name for update records. Need to change the fieldpath"
      return fieldPath.replace(OP_FIELD, OP2_FIELD);
    } else {
      // column and values are stored in "/o/$set/column_name". Need to change the fieldpath
      return fieldPath.replaceFirst(OP_FIELD, String.format("%s/%s", OP_FIELD, SET_FIELD));
    }
  }
    return fieldPath;
  }
@ Override public String getFieldPath ( String fieldPath , int operation ) { if ( operation == OperationType . UPDATE_CODE ) { if ( fieldPath . contains ( ID_FIELD ) ) { // _id is stored in "/o2/column_name for update records. Need to change the fieldpath" return fieldPath . replace ( OP_FIELD , OP2_FIELD ) ; } else { // column and values are stored in "/o/$set/column_name". Need to change the fieldpath return fieldPath . replaceFirst ( OP_FIELD , String . format ( "%s/%s" , OP_FIELD , SET_FIELD ) ) ; } } return fieldPath ; }
This is used by destination which performs CRUD operations.
Records sent from MongoOpLog origin have /o field that contains a map of
key-value for INSERT and DELETE operation, but
UPDATE record has /o2 field which contains _id and /o/$set field
which contains a map of key-value to update.
This method looks into the right field path for UPDATE so that
users don't need a separate field-column mapping for UPDATE.
@param fieldPath fieldPath in incoming record
@param operation Crud operation code
@return Actual field path in record
This is used by destination which performs CRUD operations . Records sent from MongoOpLog origin have / o field that contains a map of key - value for INSERT and DELETE operation but UPDATE record has / o2 field which contains _id and / o / $set field which contains a map of key - value to update . This method looks into the right field path for UPDATE so that users don t need a separate field - column mapping for UPDATE .