Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Items not deleting from mongodb when doDelete() called from the sync client #24

@damienomurchu

Description

@damienomurchu

Issue

Data items not deleting from collection in mongo after doDelete() is called from the client

Steps to reproduce

  • call doCreate() in the client code to create a data item to sync with the backend & into mongo
  • call doDelete() on that created data item to delete it
  • check data entry in mongodb to confirm failure to delete

A (very rough) set of client & server sync code if needed can be found here to reproduce the issue

Screenshots of issue

Before & after in mongodb collection:
selection_016
selection_017

Further info

    doDelete: function(dataset_id, uid, meta_data, cb) {
      debug(
        '[%s] doDelete :: %s :: meta=%j', dataset_id, uid, meta_data);
      mongo.collection(dataset_id).remove({"_id": convertToObjectId(dataset_id, uid)}, cb);
    },
function convertToObjectId(datasetId, originalId) {
  var newObjectId = originalId;
  if (ObjectID.isValid(originalId)) {
    newObjectId = ObjectID(originalId);
  } else {
    debug('[%s] Invalid objectId value : %s', datasetId, originalId);
  }
  return newObjectId;
}
var ObjectID = require('mongodb').ObjectID;
  • the uid and the mongo _id are usually synchronised by the sync framework to be the same, but this does not seem to be happening, thus the deletion breaks down
  • this issue should affect other operations (such as update/ read a specific entry) to fail also, but have confirmed this yet

@wtrocki @aidenkeating @wei-lee pinging you on this as requested

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions