You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that when creating a new MongoDBStore new MongoDBStore({ ... }) the MongoDB connection gets established async and is not awaited. Following the example from the readme when server = app.listen(3000); is called, the MongoDB connection is probably not yet established and store.client is undefined.
In my opinion new MongoDBStore() should return a promise that can be awaited OR there should be a separate function for connecting:
const store = await new MongoDBStore({ ... });
OR:
const store = new MongoDBStore({ ... });
await store.connect();
Current workaround:
const store = new MongoDBStore({ ... });
await new Promise((resolve) => {
store.on('connected', () => {
resolve(undefined);
});
});
The text was updated successfully, but these errors were encountered:
I noticed that when creating a new MongoDBStore
new MongoDBStore({ ... })
the MongoDB connection gets established async and is not awaited. Following the example from the readme whenserver = app.listen(3000);
is called, the MongoDB connection is probably not yet established andstore.client
is undefined.In my opinion
new MongoDBStore()
should return a promise that can be awaited OR there should be a separate function for connecting:OR:
Current workaround:
The text was updated successfully, but these errors were encountered: