New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cachegoose

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cachegoose - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

2

package.json
{
"name": "cachegoose",
"version": "3.0.1",
"version": "3.0.2",
"description": "Mongoose caching that actually works.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -66,5 +66,9 @@ # cachegoose #

That's pretty much it. Just insert `.cache()` into the queries you want to cache, and they will be cached. Works with `select`, `lean`, `sort`, and anything else that will modify the results of a query.
Insert `.cache()` into the queries you want to cache, and they will be cached. Works with `select`, `lean`, `sort`, and anything else that will modify the results of a query.
## Caching populated documents ##
When a document is returned from the cache, cachegoose will [hydrate](http://mongoosejs.com/docs/api.html#model_Model.hydrate) it, which initializes it's virtuals/methods. Hydrating a populated document will discard any populated fields (see [Automattic/mongoose#4727](https://github.com/Automattic/mongoose/issues/4727)). To cache populated documents without losing child documents, you must use `.lean()`, however if you do this you will not be able to use any virtuals/methods (it will be a plain object).
## Test ##
npm test
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc