update mongo find code to match new version
This commit is contained in:
parent
61b2106db5
commit
c5d2b292aa
@ -13,15 +13,12 @@ class MongodbTable {
|
||||
|
||||
//Data Search
|
||||
|
||||
find(query, opts = {}) { //opts: { projection: ... }
|
||||
async find(query, opts = {}) { //opts: { projection: ... }
|
||||
query = this._handleData(query);
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!this.provider._initialized) return reject(new Error('MongoDB is not connected.'));
|
||||
this.collection.find(query, opts, async (error, cursor) => {
|
||||
if (error) return reject(error);
|
||||
return resolve(await cursor.toArray());
|
||||
});
|
||||
});
|
||||
if (!this.provider._initialized) return Promise.reject(new Error('MongoDB is not connected.'));
|
||||
|
||||
const cursor = await this.collection.find(query, opts);
|
||||
return cursor.toArray();
|
||||
}
|
||||
|
||||
findOne(query, opts = {}) { //opts: { projection: ..., sort: ... }
|
||||
|
Loading…
Reference in New Issue
Block a user