Skip to content

CognitoSync RecordPatch with Operation::remove #782

@atlascoder

Description

@atlascoder

I am integrating CognitoSync into my mobile App project. I want to store small datasets and sync it among user's devices.

I can get records from cloud with CognitoSyncClient#ListRecords and update with CognitoSyncClient#UpdateRecords.

When updating records, I create RecordPatch with operations replace and remove. replace is working well: after such patches, next calls of ListRecords return updated records with lastModificationDate and SyncCount that are set when the record was updated with UpdateRecord call.

But remove works in some strange way: it does not remove records from the cloud, and that records are still returning in further ListRecords. Here is how I prepare PatchRequest for deleted records:

map<Aws::String, int> toDelete; // stores and for records to delete

for(auto to_del : toDelete){
    Model::RecordPatch patch;
    patch.SetOp(Aws::CognitoSync::Model::Operation::remove);
    patch.SetKey(Aws::String(to_del.first);
    patch.SetSyncCount(to_del.second);
    updateRequest.AddRecordPatches(patch);
}

I don't set values to records having remove operation, and ListRecords returns these records to me with empty value. But for replace patches I set value. Also, I put remove and replace patches in single request.

It looks like operation does not work properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedWe are asking the community to submit a PR to resolve this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions