How to create an exact clone / copy of a string in a parse class in a new class i.e. archive the string

I have a parse application and I am trying to "archive" old rows of data from the "data" class to another class called "DataArchive"

I do this using a scheduled cloud job which works great as a cleanup job i.e. selects my rows for a given criterion and then I call .destroy () in my .each logic like

mainQuery.each(function(dataRow) {
    counter += 1;
    _log(dataRow.get("type") + " " +
    //DataArchive = dataRow.clone()
    return dataRow.destroy();

}).then(function() {
    // Set the job success status
    status.success(counter + " Games archived successfully.");
    _log(counter + " Games archived successfully.");
}, function(error) {
    // Set the job error status
    status.error("Uh oh, something went wrong.");


I thought that it is probably not better to just delete rows, so now I am trying to "move" a row from Data to DataArchive.

I saw a .clone () method that I thought would work, but it just creates a clone in the same class, i.e. data in my case.

Does anyone have any suggestions (without specifying each column one by one) on how this can be achieved?



source to share

All Articles