ts-cache-mongoose 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,7 +26,7 @@ Caching queries is a good way to improve performance of your application
26
26
  ```json
27
27
  {
28
28
  "node": "16.x || 18.x || 20.x",
29
- "mongoose": ">=6.6.x || 7.x",
29
+ "mongoose": "6.6.x || 7.x || 8.x",
30
30
  }
31
31
  ```
32
32
 
@@ -50,15 +50,18 @@ npm install ts-cache-mongoose
50
50
  yarn add ts-cache-mongoose
51
51
  ```
52
52
 
53
- - This plugin requires mongoose `>=6.6.x || 7.x` to be installed as a peer dependency
53
+ - This plugin requires mongoose `6.6.x || 7.x || 8.x` to be installed as a peer dependency
54
54
 
55
55
  ```bash
56
56
  # For mongoose 6
57
- npm install mongoose@legacy
58
- yarn add mongoose mongoose@legacy
57
+ npm install mongoose@6.12.2
58
+ yarn add mongoose mongoose@6.12.2
59
59
  # For mongoose 7
60
- npm install mongoose@latest
61
- yarn add mongoose@latest
60
+ npm install mongoose@7.6.4
61
+ yarn add mongoose@7.6.4
62
+ # For mongoose 8
63
+ npm install mongoose@8.0.0
64
+ yarn add mongoose@8.0.0
62
65
  ```
63
66
 
64
67
  ## Example
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-cache-mongoose",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Cache plugin for mongoose Queries and Aggregate (in-memory, redis)",
5
5
  "author": "Alex Eagle",
6
6
  "license": "MIT",
@@ -82,26 +82,26 @@
82
82
  "devDependencies": {
83
83
  "@shelf/jest-mongodb": "4.1.7",
84
84
  "@swc/cli": "0.1.62",
85
- "@swc/core": "1.3.93",
85
+ "@swc/core": "1.3.96",
86
86
  "@swc/helpers": "0.5.3",
87
87
  "@swc/jest": "0.2.29",
88
88
  "@swc/register": "0.1.10",
89
- "@types/jest": "29.5.5",
90
- "@types/ms": "0.7.32",
91
- "@types/node": "18",
92
- "@typescript-eslint/eslint-plugin": "6.7.5",
93
- "@typescript-eslint/parser": "6.7.5",
94
- "eslint": "8.51.0",
95
- "eslint-plugin-jest": "27.4.2",
89
+ "@types/jest": "29.5.7",
90
+ "@types/ms": "0.7.33",
91
+ "@types/node": "20",
92
+ "@typescript-eslint/eslint-plugin": "6.9.1",
93
+ "@typescript-eslint/parser": "6.9.1",
94
+ "eslint": "8.53.0",
95
+ "eslint-plugin-jest": "27.6.0",
96
96
  "eslint-plugin-jest-formatting": "3.1.0",
97
- "eslint-plugin-sonarjs": "0.21.0",
97
+ "eslint-plugin-sonarjs": "0.23.0",
98
98
  "jest": "29.7.0",
99
99
  "merge": "2.1.1",
100
- "mongoose": "6.12.1",
100
+ "mongoose": "latest",
101
101
  "open-cli": "7.2.0",
102
102
  "typescript": "5.2.2"
103
103
  },
104
104
  "peerDependencies": {
105
- "mongoose": ">=6.6.0 < 8"
105
+ "mongoose": ">=6.6.0 < 9"
106
106
  }
107
107
  }
@@ -185,9 +185,9 @@ describe('CacheMongoose', () => {
185
185
  })
186
186
 
187
187
  it('count', async () => {
188
- const count = await User.count({ age: { $gte: 30 } }).cache('1 minute').exec()
188
+ const count = await User.countDocuments({ age: { $gte: 30 } }).cache('1 minute').exec()
189
189
  await User.create({ name: 'Steve', age: 30, role: 'admin' })
190
- const cachedCount = await User.count({ age: { $gte: 30 } }).cache('1 minute').exec()
190
+ const cachedCount = await User.countDocuments({ age: { $gte: 30 } }).cache('1 minute').exec()
191
191
 
192
192
  expect(count).toEqual(cachedCount)
193
193
  })