小编Ari*_*lón的帖子

ClientSession 无法序列化为 BSON

你好,我一直在尝试使用 mongoose 在我的 mongodb 图集上对我的 crud 操作实施交易,我试图查找教程和东西,但周围真的没有那么多,我有这个问题“ClientSession 不能在我尝试点击用户创建路由后序列化为 BSON”,我的代码:

router.post(
'/',
[
check('name', 'Por favor, ingresar el nombre')
  .not()
  .isEmpty(),
check('email', 'Por favor, ingresar un correo válido').isEmail(),
check(
  'password',
  'Por favor, ingresar una contraseña con 6 o más carácteres'
).isLength({ min: 6 })
],
async (req, res) => {
const errors = validationResult(req);
if (!errors.isEmpty()) {
  return res.status(400).json({ errors: errors.array() });
}

    const { name, email, password, imagen } = req.body;

    const session = await User.startSession() // Las transacciones usan …
Run Code Online (Sandbox Code Playgroud)

transactions mongoose node.js

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

标签 统计

mongoose ×1

node.js ×1

transactions ×1