Proper way to store documents in MongoDB

// Guild Schema

{
  guildId: Number,
  guildName: String,
  other: String
}

// User Schema

{
  userId: Number,
  guild: {
    type: Schema.Types.ObjectId,
    ref: "Guild"
  },
  userInfo:{
    name: String,
    address: String,
    other: String
  }
}
Topics: MongoDB

Related Code Examples