forked from Galactic/galactic-bot
update mongo aggregate caller
This commit is contained in:
parent
67e796d334
commit
58e4980bc3
@ -38,13 +38,8 @@ class MongodbTable {
|
|||||||
|
|
||||||
aggregate(query) {
|
aggregate(query) {
|
||||||
query = this._handleData(query);
|
query = this._handleData(query);
|
||||||
return new Promise((resolve, reject) => {
|
if (!this.provider._initialized) return Promise.reject(new Error('MongoDB is not connected.'));
|
||||||
if (!this.provider._initialized) return reject(new Error('MongoDB is not connected.'));
|
return this.collection.aggregate(query).toArray();
|
||||||
this.collection.aggregate(query, (error, item) => {
|
|
||||||
if (error) return reject(error);
|
|
||||||
return resolve(item.toArray());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
random(query, amount = 1) {
|
random(query, amount = 1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user