Closed Rahuletto closed 1 year ago
Property 'cache' does not exist on type 'Query<Document<unknown, {}, { files: DocumentArray<any> | any[] | { [x: string]: any; }[] | any[]; options: DocumentArray<any> | any[] | { [x: string]: any; }[] | any[]; key?: unknown; name?: unknown; description?: unknown; createdAt?: unknown; }> & Omit<...>, Document<...> & Omit<...>, {}, { ...; }, "findOne">'. Did you mean 'catch'? ts(2551)
This can be simply said that Query.cache() is not a function.
Query
"mongoose": "^7.2.2", "recachegoose": "^9.2.0"
(Using Typescript)
import mongoose from 'mongoose';
import cachegoose from 'recachegoose';
cachegoose(mongoose, { engine: 'memory' });
- fetch.ts ```ts const result: Board = await Schema.findOne({ key: queries.id }).cache(0);
const result: Board = await Schema.findOne({ key: queries.id }).cache(0); ^^^^^ Property 'cache' does not exist on type 'Query<Document<unknown, {}, { files: DocumentArray<any> | any[] | { [x: string]: any; }[] | any[]; options: DocumentArray<any> | any[] | { [x: string]: any; }[] | any[]; key?: unknown; name?: unknown; description?: unknown; createdAt?: unknown; }> & Omit<...>, Document<...> & Omit<...>, {}, { ...; }, "findOne">'. Did you mean 'catch'?
Edit: Tried with a implementation similar to your documentation README.md. Its the same
README.md
Schema.findOne({ key: queries.id }).cache(0).exec(function(err, records) { console.log('Yay i work') });
Property 'cache' does not exist on type 'Query<Document<unknown, {}, { files: DocumentArray<any> | any[] | { [x: string]: any; }[] | any[]; options: DocumentArray<any> | any[] | { [x: string]: any; }[] | any[]; key?: unknown; name?: unknown; description?: unknown; createdAt?: unknown; }> & Omit<...>, Document<...> & Omit<...>, {}, { ...; }, "findOne">'. Did you mean 'catch'?
Have you tried with the latest version? coz there is someone has created the PR 2 weeks ago.
I'm sorry I moved to an entirely new database now. Thank you if you fixed it.
This can be simply said that
Query
.cache() is not a function.Versions:
Reproduction
(Using Typescript)
import cachegoose from 'recachegoose';
cachegoose(mongoose, { engine: 'memory' });
ERROR:
Edit: Tried with a implementation similar to your documentation
README.md
. Its the same