Skip to content
Nishant Racherla edited this page Jan 16, 2023 · 8 revisions

users collection

{
  username: {
    type: String,
    required: true,
    unique: true
  },
  email: {
    type: String,
    required: true,
    unique: true
  },
  password: {
    type: String,
    required: true
  },
  bio: {
    type: String,
    required: true
  },
  profilePicUrl: {
    type: String
  },
  photos: [{
    type: ObjectId, 
    ref: "Photo"
  }]
}

spots collection

{
  latitude: {
    type: Number,
    required: true,
  },
  longitude: {
    type: Number,
    required: true,
  },
  name: {
    type: String,
    required: true
  },
  comments: [{
    type: ObjectId,
    ref: "Comment"
  }],
  photos: [{
    type: ObjectId, 
    ref: "Photo"
  }]
}

locations collection

{
  zipcode: {
    type: Number,
    required: true
  },
  cityName: {
    type: String,
    required: true
  },
  spots: [{
    type: ObjectId,
    ref: "Spot"
  }]
}

comments collection

{
  body: {
    type: String,
    required: true
  },
  userId: {
    type: ObjectId,
    ref: "User"
  },
  spotId: {
    type: ObjectId,
    ref: "Spot"
  }
}

likes collection

{
  photoId: {
    type: ObjectId,
    ref: "Photo"
  },
  likerId: {
    type: ObjectId,
    ref: "User"
  }
}

photos collection

{
  url: {
    type: String,
    required: true
  },
  spotId: {
    type: ObjectId,
    ref: "Spot"
  },
  userId: {
    type: ObjectId,
    ref: "User"
  },
  genre: {
    type: String,
    required: true
  },
  description: {
    type: String
  },
  condition: {
    type: String,
    required: true
  },
  transportation: {
    type: String,
    required: true
  },
  bestTimeOfDay: {
    type: String,
    required: true
  },
  payment: {
    type: String,
    required: true
  }
  likes: [{
    type: ObjectId,
    ref: "Like"
  }]
}

Clone this wiki locally