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

deleteFromCacheByFields fails when the query only uses one field #81

Open
eth0lo opened this issue Sep 27, 2021 · 4 comments
Open

deleteFromCacheByFields fails when the query only uses one field #81

eth0lo opened this issue Sep 27, 2021 · 4 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@eth0lo
Copy link

eth0lo commented Sep 27, 2021

For example.

this.findByFields({
  tag: new ObjectId('some-tag-id')
})

and

this.deleteFromCacheByFields({
  tag: new ObjectId('some-tag-id')
})

generate different keys, for this case it will generate: {"tag":{"$oid":"6151e9b4b005977991064607"}} and {"tag":[{"$oid":"6151e9b4b005977991064607"}]} respectively; which will prevent the method from behaving correctly

the issue is generated here

@tubbo
Copy link
Contributor

tubbo commented Sep 27, 2021

The logic on https://github.com/GraphQLGuide/apollo-datasource-mongodb/blob/master/src/cache.js#L187-L200 basically needs to make its way into deleteFromCacheByFields() as that will make the keys match up.

@lorensr lorensr added bug Something isn't working help wanted Extra attention is needed labels Oct 3, 2021
@bentburton
Copy link

Any progress on this?

@bentburton
Copy link

Having the same issue

@bentburton
Copy link

Addressed in 95

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants