Skip to content

Commit

Permalink
Exposed countDocuments method
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardudycz committed Jul 12, 2024
1 parent 6e1e00f commit 9f67741
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/packages/pongo/src/main/typing/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface PongoCollection<T extends PongoDocument> {
deleteMany(filter: PongoFilter<T>): Promise<PongoDeleteResult>;
findOne(filter: PongoFilter<T>): Promise<T | null>;
find(filter: PongoFilter<T>): Promise<T[]>;
countDocuments(filter: PongoFilter<T>): Promise<number>;
drop(): Promise<boolean>;
rename(newName: string): Promise<PongoCollection<T>>;
handle(id: string, handle: DocumentHandler<T>): Promise<T | null>;
Expand Down
4 changes: 2 additions & 2 deletions src/packages/pongo/src/mongo/mongoCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,10 @@ export class Collection<T extends Document> implements MongoCollection<T> {
throw new Error('Method not implemented.');
}
countDocuments(
_filter?: Filter<T> | undefined,
filter?: Filter<T> | undefined,
_options?: CountDocumentsOptions | undefined,
): Promise<number> {
throw new Error('Method not implemented.');
return this.collection.countDocuments(filter as PongoFilter<T>);
}
distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(
key: Key,
Expand Down

0 comments on commit 9f67741

Please sign in to comment.