1+ import { AdapterBase , AdapterParams , AdapterServiceOptions , PaginationOptions } from '@feathersjs/adapter-commons' ;
2+ import { Model , Query , PopulateOptions , ClientSession , Document } from 'mongoose' ;
3+ import { Id , Paginated } from '@feathersjs/feathers' ;
4+ export interface MongooseAdapterOptions < T extends Document = Document > extends AdapterServiceOptions {
5+ Model : Model < T > ;
6+ lean ?: boolean ;
7+ overwrite ?: boolean ;
8+ discriminators ?: Model < T > [ ] ;
9+ useEstimatedDocumentCount ?: boolean ;
10+ queryModifier ?: ( query : Query < T , T > ) => void ;
11+ }
12+ export interface MongooseAdapterParams extends AdapterParams {
13+ mongoose ?: {
14+ session ?: ClientSession ;
15+ upsert ?: boolean ;
16+ writeResult ?: boolean ;
17+ } ;
18+ query ?: {
19+ $populate ?: PopulateOptions | PopulateOptions [ ] ;
20+ [ key : string ] : unknown ;
21+ } ;
22+ queryModifier ?: ( ( query : Query < Document , Document > ) => void ) | false ;
23+ collation ?: MongooseCollation ;
24+ }
25+ export type AdapterId = Id ;
26+ export type NullableAdapterId = AdapterId | null ;
27+ interface MongooseCollation {
28+ locale : string ;
29+ strength ?: number ;
30+ [ key : string ] : unknown ;
31+ }
32+ export declare class MongooseAdapter < Result extends Document = Document , Data = Partial < Result > , ServiceParams extends MongooseAdapterParams = MongooseAdapterParams , PatchData = Partial < Data > > extends AdapterBase < Result , Data , PatchData , ServiceParams , MongooseAdapterOptions < Result > > {
33+ Model : Model < Result > ;
34+ lean : boolean ;
35+ overwrite : boolean ;
36+ discriminatorKey : string ;
37+ discriminators : Record < string , Model < Result > > ;
38+ useEstimatedDocumentCount : boolean ;
39+ constructor ( options : MongooseAdapterOptions < Result > ) ;
40+ get id ( ) : string ;
41+ allowsMulti ( method : string , params ?: MongooseAdapterParams ) : boolean ;
42+ _getQueryModifier ( params ?: MongooseAdapterParams ) : ( modelQuery : Query < any , any > ) => Query < any , any , { } , any > ;
43+ private applyPopulate ;
44+ private getModelForParams ;
45+ private applyCollation ;
46+ private checkIdConflict ;
47+ private buildFinalQuery ;
48+ private performOptimizedMultiPatch ;
49+ private performSingleDocumentPatch ;
50+ private performMultiDocumentPatch ;
51+ private applySelect ;
52+ _find ( params ?: ServiceParams & {
53+ paginate ?: PaginationOptions ;
54+ } ) : Promise < Paginated < Result > > ;
55+ _find ( params ?: ServiceParams & {
56+ paginate : false ;
57+ } ) : Promise < Result [ ] > ;
58+ _find ( params ?: ServiceParams ) : Promise < Paginated < Result > | Result [ ] > ;
59+ _get ( id : Id , params ?: ServiceParams ) : Promise < Result > ;
60+ _create ( data : Data , params ?: ServiceParams ) : Promise < Result > ;
61+ _create ( data : Data [ ] , params ?: ServiceParams ) : Promise < Result [ ] > ;
62+ _create ( data : Data | Data [ ] , params ?: ServiceParams ) : Promise < Result | Result [ ] > ;
63+ _update ( id : Id , data : Data , params ?: ServiceParams ) : Promise < Result > ;
64+ _patch ( id : null , data : PatchData , params ?: ServiceParams ) : Promise < Result [ ] > ;
65+ _patch ( id : Id , data : PatchData , params ?: ServiceParams ) : Promise < Result > ;
66+ _patch ( id : Id | null , data : PatchData , params ?: ServiceParams ) : Promise < Result | Result [ ] > ;
67+ _remove ( id : null , params ?: ServiceParams ) : Promise < Result [ ] > ;
68+ _remove ( id : Id , params ?: ServiceParams ) : Promise < Result > ;
69+ _remove ( id : Id | null , params ?: ServiceParams ) : Promise < Result | Result [ ] > ;
70+ }
71+ export { } ;
72+ //# sourceMappingURL=adapter.d.ts.map
0 commit comments