如何在猫鼬中保存对象

时间:2018-10-17 06:46:12

标签: express mongoose mongoose-schema

我想使用对象来组合管理员,但我不知道。这是架构和代码

yourView.didSelectCallback = { [weak self] in 
   guard let weakSelf = self else {return}
   let vc = UIStoryboard.init(name: "ProductListing", bundle: Bundle.main).instantiateViewController(withIdentifier: "ProductListingViewController") as? ProductListingViewController
   weakSelf.navigationController?.pushViewController(vc!, animated: true)}
}

保存功能:

UserSchema = new mongoose.Schema({
  name: { type:String },
  owner : {
    Admin       : mongoose.Schema.Types.ObjectId
    }
});

当我检查名称已保存但owner.Admin未保存时。

1 个答案:

答案 0 :(得分:0)

保存之前,您应标记为已修改的嵌套对象

    .carousel {
        scroll-snap-type: x mandatory;
    }