Automattic / Automattic/mongoose

Question: caching query results (memory, redis, etc.)

Open
#5,414 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
27.5k
Forks
4k
Avg merge
2d 7h
Merged PRs (30d)
35

Description

Quick question: how do you guys cache your mongoose query results?
I know mongodb is supposed to be fast et al, but some heavy queries (like aggregate) in some use-cases benefit a lot from in-memory or redis result caching.
There are some existing npm packages to do that, but they are all failing to do the job correctly. And they are all obscure 12 stars, not updated since 2014, monkey-patching codebase.

Caching is such an important matter in software engineering, that I'm wondering why there is no "official" way to do that in mongoose.

Contributor guide

Open the contributing guide

Research direction

No source files, tests, or entry points are named. Start by clarifying the expected caching API and supported memory or Redis behavior, then review how Mongoose exposes query and aggregate execution; done would require an agreed official caching design rather than a narrowly scoped edit.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, nodejs
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.