首页 > 解决方案 > 我想通过 id 查找数据并传递正确的 id 但返回为 null

问题描述

我正在尝试通过 id 获取文件夹,但它返回 null。id 是 60915920daf6db4b201d7c77 对象数据

{"_id":{"$oid":"60915920daf6db4b201d7c77"},
"parentRef":[],
"isDeleted":false,
"isVisible":true,
"name":"videos",
"userRef":{"$oid":"608fa0178187d43f80e88112"},
"createdAt":{"$date":"2021-05-04T14:24:32.202Z"},
"updatedAt":{"$date":"2021-05-04T14:24:32.202Z"},"__v":0}
import { Videos } from "../../db/index";

export async function folderName(id) {
  console.log(id);
  const folder = await Videos.findById(id);
  console.log(folder);
}

标签: mongodb

解决方案


推荐阅读