mongo db with promise(async).
mongoose
.connect("mongodb://127.0.0.1:27017/shopping", { useNewUrlParser: true })
.then(res => {
logger.info("Connected to MongoDB");
});
}In the main entry script, I have session setting like below executed before connecting to mongo
app.use(
session({
secret: "43jkfd5kjG90",
resave: false,
saveUninitialized: false,
store: new MongoStore({ mongooseConnection: mongoose.connection })
})
);Is it OK? I do not have any problem with it.
Is it suitable to apply sync connection and after connecting to db I run other lines (commands)?
👆
Обсуждают сегодня