const mongoose = require('mongoose')
const { Schema } = mongoose

const locationSchema = new Schema({
  address: { type: String, unique: true, required: true },
  rating: Number,
  reviews: [{rating: Number, content: String, userId: String}],
  photos: [],
  description: String,
  loc: { type: [Number], index: { type: '2dsphere' } }
})

const Location = mongoose.model('Location', locationSchema)
module.exports = Location

const mongoose = require('mongoose')
const { Schema } = mongoose

const locationSchema = new Schema({
  address: { type: String, unique: true, required: true },
  rating: { type: Number, default: 0 },
  reviews: [{rating: Number, content: String, userId: String}],
  photos: [],
  description: String,
  loc: { type: [Number], index: { type: '2dsphere' } }
})

const Location = mongoose.model('Location', locationSchema)
module.exports = Location

Adjust location model to have default rating of 0
Adjust location model to have default rating of 0
