小编Seb*_*osa的帖子

在mongoose的字段中将函数定义为默认值

我想做这样的事情:

var categorySchema = new Schema({
  id: {
    unique: true,
    default: function() {
      //set the last item inserted id + 1 as the current value.
    }
  },
  name: String
});
Run Code Online (Sandbox Code Playgroud)

这是可能的吗?

javascript mongoose mongodb node.js express

5
推荐指数
1
解决办法
3334
查看次数

标签 统计

express ×1

javascript ×1

mongodb ×1

mongoose ×1

node.js ×1