Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removeRxDatabase is not working #6841

Open
wazzu3000 opened this issue Feb 10, 2025 · 5 comments
Open

removeRxDatabase is not working #6841

wazzu3000 opened this issue Feb 10, 2025 · 5 comments

Comments

@wazzu3000
Copy link

Hello, I'm using your tool to store local data in the device when the user is login to the app, but I need to remove the data before the user is logoff.

I tried use removeRxDatabase but this is not working for me, I share with you a small example.

public async testRemoveRxDatabase() {
  const devModeModule = await import('rxdb/plugins/dev-mode');
  const validateZSchemaModule = await import('rxdb/plugins/validate-z-schema');
  const storage = validateZSchemaModule.wrappedValidateZSchemaStorage({ storage: getRxStorageDexie() });
  disableWarnings();
  addRxPlugin(devModeModule.RxDBDevModePlugin);

  const dbInstance = await createRxDatabase({
    name: 'test',
    storage: storage
  });

  await dbInstance.addCollections({
    someCollection: {
      schema: someCollectionSchema
    }
  });

  // values is an object array
  await dbInstance.collections['someCollection'].bulkInsert(values);

  // I get all documents previously inserted
  let documents = await dbInstance.collections['someCollection'].find().exec()
  await removeRxDatabase('test', storage);

  // This query should return an empty array, but still getting all documents.
  documents = await dbInstance.collections['someCollection'].find().exec()
}
@pubkey
Copy link
Owner

pubkey commented Feb 10, 2025

Can you make a PR with a test case that reproduces your problem?
You can start with this template.

@wazzu3000
Copy link
Author

Yes sure. Which branch I should target the PR?

@pubkey
Copy link
Owner

pubkey commented Feb 10, 2025

master

@wazzu3000
Copy link
Author

Hello, sorry for my delay, I just created the PR. I share with you the link #6848

Copy link

stale bot commented Feb 19, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon. Please update it or it may be closed to keep our repository organized. The best way is to add some more information or make a pull request with a test case. Also you might get help in fixing it at the RxDB Community Chat If you know you will continue working on this, just write any message to the issue (like "ping") to remove the stale tag.

@stale stale bot added the stale label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants