交替默认的猫鼬布尔值

时间:2018-08-19 16:58:31

标签: mongodb mongoose mongoose-schema

所以我有以下模式:

const UserSchema = new mongoose.Schema({
  name: { type: String, required: true },
  organization: { type: mongoose.Schema.Types.ObjectId, ref: "Org" },
  clocks: [
    {
      date: { type: Date, default: Date.now },
      lunch: Boolean,
      in: Boolean
    }
  ]
});

我希望Clocks数组上的“ in”值与默认值交替显示。

  

(真,假,真,假等)

我怎么用猫鼬设置它?

0 个答案:

没有答案
相关问题