{"size": 1032, "ext": "js", "max_stars_repo_path": "models/PlaceModel.js", "max_stars_repo_name": "pramita21/placesAPI", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "models/PlaceModel.js", "max_issues_repo_name": "pramita21/placesAPI", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "models/PlaceModel.js", "max_forks_repo_name": "pramita21/placesAPI", "max_forks_repo_forks_event_min_datetime": "2022-02-07T14:25:32.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T17:32:11.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 24.5714285714, "max_line_length": 54, "alphanum_fraction": 0.6027131783}
var mongoose = require("mongoose");

var Schema = mongoose.Schema;
const pointSchema = new mongoose.Schema({
  type: {
    type: String,
    enum: ["Point"],
    required: true,
  },
  coordinates: {
    type: [Number],
    required: true,
  },
});

var PlaceSchema = new Schema(
  {
    name: { type: String, required: true },
    address: { type: String, required: true },
    description: { type: String, required: false },
    image: { type: String, required: true },
    cta: { type: String, required: false },
    price: {
      currency: { type: String, required: false },
      maxprice: { type: String, required: false },
      minprice: { type: String, required: false },
    },
    type: { type: String, required: false },
    rating: { type: String, required: false },
    category: { type: String, required: true },
    location: {
      type: pointSchema,
      required: true,
    },
  },
  { timestamps: true }
);

PlaceSchema.index({ location: "2dsphere" });

module.exports = mongoose.model("Place", PlaceSchema);
