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

Bugfix: Return _id as ObjectId from cache #66

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tenorok
Copy link
Contributor

@tenorok tenorok commented Nov 19, 2020

Despite the use of lean() mongoose returns _id field as instance of ObjectId. But in cached result this field returned as a string.

@tenorok
Copy link
Contributor Author

tenorok commented Nov 29, 2020

@boblauer what do you think?

@tenorok
Copy link
Contributor Author

tenorok commented Dec 19, 2020

@boblauer pay attention please :-)

@aalfiann
Copy link

your code seems broken, have you try npm run lint ?

but your idea is great, I agree with this, the _id must return back as ObjectId from cache result.

@aalfiann
Copy link

For best perfomance, you have to use for loop than map.

  • for is faster than forEach.
  • forEach is faster than map.

you must consider of this because cachedResults may have big data array.

@tenorok
Copy link
Contributor Author

tenorok commented Feb 23, 2021

@aalfiann you're fully right about performance, I just tried to follow current codestyle. In the latest commit I've remake realization to more faster.

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 this pull request may close these issues.

2 participants