Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Delete Private Data Collection Key #25

Open
thebubbleindex opened this issue Jun 4, 2019 · 1 comment
Open

Delete Private Data Collection Key #25

thebubbleindex opened this issue Jun 4, 2019 · 1 comment

Comments

@thebubbleindex
Copy link

Hi, I am encountering an issue in using the private data collection functionality. I realize this is a newer feature, however, I am wondering if all the functionality is implemented? Can private data collection entries be deleted in the fabric-mock-stub package? In particular, I am able to use the putPrivateData and getPrivateData functions, but the deletePrivateData does not seem to delete the key from the collection. I tried:

  1. putPrivateData -> key="1234", value="5678" - success
  2. deletePrivateData -> key="1234" - success
  3. queryPrivateData -> key="1234" - success

However the final query is returning the "5678" value. But it is supposed to fail. Thanks

@oOhoraOo
Copy link

oOhoraOo commented Jul 23, 2020

Maybe you can fix deletePrivateData and it will work.

fabric-mock-stub/src/ChaincodeMockStub.ts

deletePrivateData(collection: string, key: string): Promise<any> {
    const value = (this.privateCollections[collection] || {})[key];

    if (value) {
        // (this.privateCollections[collection] as StateMap).delete(key);     // ← Incorrect !!
        delete this.privateCollections[collection][key];
    }

    return Promise.resolve();
}

oOhoraOo pushed a commit to oOhoraOo/fabric-mock-stub that referenced this issue Jul 25, 2020
sneljo1 added a commit that referenced this issue Jul 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants