小编Ryu*_*aki的帖子

? 'expireAfterSeconds' 选项仅在 '_ts' 字段上受支持。? 显示错误

我在 node.js 中使用 cosmos db 进行会话存储。宇宙数据库版本是 3.6 。

我执行以下代码。

const expressSession = require("express-session");
const MongoStore = require("connect-mongo")(expressSession);
const store = new MongoStore({
        mongooseConnection: mongoose.connection,
        ttl:24 * 60 * 60 * 1000,
})
Run Code Online (Sandbox Code Playgroud)

结果,显示以下消息。

  (node:16068) UnhandledPromiseRejectionWarning: MongoError: The 'expireAfterSeconds' option is supported on '_ts' field only.
Run Code Online (Sandbox Code Playgroud)

这个问题的解决方案是什么?

node.js azure-cosmosdb azure-cosmosdb-mongoapi

3
推荐指数
1
解决办法
1249
查看次数