let mongoose=require('mongoose');
let id='5aeac9a955fa7427474594d5';

1、字符串转ObjectId

mongoose.Types.ObjectId(id);

2、ObjectId转字符串

mongoose.Types.ObjectId(id).toString()

相关文章:

  • 2022-01-16
  • 2021-05-26
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2021-09-19
  • 2021-12-27
猜你喜欢
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案