如何使用猫鼬在mongodb集合中建立关系

时间:2019-02-17 17:10:02

标签: node.js mongodb mongoose mongoose-schema mongoose-populate

我有两个馆藏,一个用于会员详细信息,一个用于饲养动物,该会员可能每月支付费用,我该如何建立这种关系

这是我的成员架构

  var Schema = mongoose.Schema;

  SomeModelSchema = new Schema({
  member_name: String,
  imageurl:String,
  doj:Date,
  dob: Date,
  gender:String,
  weight:Number,
  height:Number,
  blood_Group:String,
  email:String,
  phone:Number,
  Home:Number,
  Home:String,
  post:String,
  city :String,
  district:String,
  state:String,
  pin:Number,
  m_id:String,
  m_type:String,
  fee:[{ type: Schema.Types.ObjectId, ref: 'FeeDetails' }]
});

这是我的Feedetails架构

 feeSchema=new Schema({
 amount:Number,
 Package:Number,
 paid_date:Date,
 due_date:Date,
 creator: Schema.Types.ObjectId
});

如何创建和更新收藏集?

0 个答案:

没有答案