Open Striller18 opened 9 months ago
The method "all" is not working because the method "toArray" changed from callback to promise
this.db.collection(this.options.collection). find({}).toArray(function(error, sessions) { if (error) { const e = new Error('Error gathering sessions'); return _this._errorHandler(e, callback); } else if (sessions) { if (sessions) { return callback(null, sessions); } } else { return callback(); } });
return this.db.collection(this.options.collection).find({}).toArray() .then( sessions => { return callback(null, sessions); }) .catch( error =>{ const e = new Error('Error finding sessions: ' + error.message); return _this._errorHandler(e, callback); })
The method "all" is not working because the method "toArray" changed from callback to promise
Before
After