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

Count method returns undefined #76

Closed
MohitS69 opened this issue Mar 6, 2024 · 5 comments · Fixed by #79
Closed

Count method returns undefined #76

MohitS69 opened this issue Mar 6, 2024 · 5 comments · Fixed by #79

Comments

@MohitS69
Copy link

MohitS69 commented Mar 6, 2024

I am getting undefined when trying to cache the count of documents according to current query.

Screenshot at 2024-03-06 19-27-26

@MohitS69
Copy link
Author

MohitS69 commented Mar 6, 2024

This is only occuring when i got 0 documents. If i am getting documents more than 0 then it is not returning undefined

@MohitS69
Copy link
Author

MohitS69 commented Mar 7, 2024

cacheQuery is not caching the result searched using regex. I think this is due that regex expressions cannot be stringified.Tell me if there is a genuine way to cache them.
Screenshot at 2024-03-07 13-05-43

@arqo123
Copy link
Owner

arqo123 commented Mar 7, 2024

I've made a quick check and yes, that seems like a bug. Good catch with those regexp values. I will think about the way of handling them correctly. I haven't verify yet your first question. Could You split them into two issues? Or are they related?

@MohitS69
Copy link
Author

MohitS69 commented Mar 8, 2024

they are both different questions.

  1. There is a bug when caching count() it returns undefined if there is no document found in the database. If documents are in the number greater than 0 then it will return number but in case of 0 it returns undefined.
  2. Regex expression wasn't working properly with caching strategy.

@arqo123
Copy link
Owner

arqo123 commented Mar 8, 2024

Please split them into two issues then. I will have a look. Good job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants