import {Schema}from'mongoose';import {commonModeSchemaOptions,addIdVirtualFields}from'@common-stack/store-mongo';const cityModelSchema = new Schema({
  name: {
    type: Schema.Types.String,
    required: true,
    maxlength: 150
  },
  state: {
    type: Schema.Types.String,
    ref: 'states',
    required: true,
    onDelete: 'cascade'
  },
  _id: {
    type: Schema.Types.String,
    required: true,
    unique: true
  },
  location: {
    type: {
      type: Schema.Types.String,
      default: 'Point',
      enum: ['Point'] // 'location.type' must be 'Point'
    },
    coordinates: {
      type: [Schema.Types.Number],
      required: true
    }
  }
}, {
  ...commonModeSchemaOptions,
  _id: false
});
cityModelSchema.index({
  name: 1,
  state: 1
}, {
  unique: true
});
cityModelSchema.index({
  _id: 1,
  state: 1
}, {
  unique: true
});
cityModelSchema.index({
  location: '2dsphere'
});
addIdVirtualFields(cityModelSchema);
const CityModelFunc = db => db.model('cities', cityModelSchema);export{CityModelFunc};//# sourceMappingURL=city.js.map
