Mongoose detect database not ready

后端 未结 4 1043
暖寄归人
暖寄归人 2021-01-11 19:27

Is it possible to detect that the database is not running with Mongoose ?

4条回答
  •  旧巷少年郎
    2021-01-11 19:51

    The straight forward works fine for me:

    mongoose.Connection.STATES.connected === mongoose.connection.readyState

提交回复
热议问题