Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

method all callback not works #114

Open
Striller18 opened this issue Feb 23, 2024 · 1 comment
Open

method all callback not works #114

Striller18 opened this issue Feb 23, 2024 · 1 comment

Comments

@Striller18
Copy link

Striller18 commented Feb 23, 2024

The method "all" is not working because the method "toArray" changed from callback to promise

Before

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();
        }
      });

After

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);
    })
@sophos-rickc
Copy link

I am experiencing this same issue. Will this be fixed? Is connect-mongodb-session still being maintained?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants