小编gia*_*ise的帖子

获取“TypeError:schema.virtual(...).get 不是函数”

当我尝试定义架构时出现此错误。

错误:

node_modules/mongoose/lib/plugins/idGetter.js:12
    schema.virtual('id').get(idGetter);

TypeError: schema.virtual(...).get is not a function
    at module.exports (/Users/g.paradiso/dev/albumin-diet/node_modules/mongoose/lib/plugins/idGetter.js:12:26)
Run Code Online (Sandbox Code Playgroud)

架构:

export const albumSchema = new Schema({
  id: {
    spotify: String
  },
  tags: [{ type: Schema.Types.ObjectId, ref: "Tag" }],
}, { timestamps: true });
Run Code Online (Sandbox Code Playgroud)

javascript mongoose node.js

0
推荐指数
1
解决办法
2650
查看次数

标签 统计

javascript ×1

mongoose ×1

node.js ×1