44 FilterQuery ,
55 Model ,
66 ModifyResult ,
7+ MongooseBaseQueryOptions ,
78 ProjectionType ,
89 Query ,
910 QueryOptions ,
@@ -15,6 +16,7 @@ import { EventEmitterSeparator } from '~/_common/constants/event-emitter.constan
1516import { AbstractService , AbstractServiceContext } from './abstract.service' ;
1617import { ServiceSchemaInterface } from './interfaces/service.schema.interface' ;
1718import { AbstractSchema } from './schemas/abstract.schema' ;
19+ import mongodb from 'mongodb' ;
1820
1921@Injectable ( )
2022export abstract class AbstractServiceSchema extends AbstractService implements ServiceSchemaInterface {
@@ -39,7 +41,7 @@ export abstract class AbstractServiceSchema extends AbstractService implements S
3941 return await this . _model . find < Query < Array < T > , T , any , T > > ( filter , projection , options ) . exec ( )
4042 }
4143
42- public async count < T extends AbstractSchema | Document > ( filter ?: FilterQuery < T > , options ?: QueryOptions < T > ) : Promise < number > {
44+ public async count < T extends AbstractSchema | Document > ( filter ?: FilterQuery < T > , options ?: ( mongodb . CountOptions & MongooseBaseQueryOptions < T > ) | null ) : Promise < number > {
4345 //TODO: add event emitter
4446 this . logger . debug ( [ 'count' , JSON . stringify ( Object . values ( arguments ) ) ] . join ( ' ' ) )
4547 return await this . _model . countDocuments ( filter , options ) . exec ( )
@@ -243,7 +245,7 @@ export abstract class AbstractServiceSchema extends AbstractService implements S
243245 }
244246 }
245247 return updated
246- }
248+ }
247249
248250 public async upsert < T extends AbstractSchema | Document > (
249251 filter : FilterQuery < T > ,
@@ -299,7 +301,7 @@ export abstract class AbstractServiceSchema extends AbstractService implements S
299301
300302 return result ;
301303 }
302-
304+
303305
304306 public async delete < T extends AbstractSchema | Document > ( _id : Types . ObjectId | any , options ?: QueryOptions < T > | null | undefined ) : Promise < Query < T , T , any , T > > {
305307 this . logger . debug ( [ 'delete' , JSON . stringify ( Object . values ( arguments ) ) ] . join ( ' ' ) )
0 commit comments