Skip to content

Commit

Permalink
ProBun 0.1.32 introduces options to MongoService.find()
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamint08 committed May 27, 2024
1 parent 71485db commit 92775c1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/instances/mongodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@ class Mongo {
return collection.insertOne(data);
}

async find(db: string, col: string, query: any): Promise<any[]> {
async find(db: string, col: string, query: any, options: any): Promise<any[]> {
let opts = {};
if (options) {
opts = options;
}
if (!this.isConnected) {
throw new Error('Not connected to MongoDB');
}
const collection = await this.getCollection(db, col);
return collection.find(query).toArray();
return collection.find(query, options).toArray();
}

async findOne(db: string, col: string, query: any): Promise<any> {
Expand Down

0 comments on commit 92775c1

Please sign in to comment.