{"size": 738, "ext": "js", "max_stars_repo_path": "server/dbs/models/users.js", "max_stars_repo_name": "XiaoYimi/it-blog", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "server/dbs/models/users.js", "max_issues_repo_name": "XiaoYimi/it-blog", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "server/dbs/models/users.js", "max_forks_repo_name": "XiaoYimi/it-blog", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 15.0612244898, "max_line_length": 50, "alphanum_fraction": 0.5257452575}
import mongoose from 'mongoose'

const userSchema = new mongoose.Schema({
  nickname: {
    type: String,
    unique: true,
    require: true
  },
  pass: {
    type: String,
    require: true
  },
  signup: {
    type: String,
    require: true
  },
  occupation: {
    type: String,
    default: ''
  },
  province: {
    type: Object,
    default: {
      code: '11',
      name: '北京市'
    }
  },
  city: {
    type: Object,
    default: {
      code: '1101',
      name: '市辖区',
      pcode: '11'
    }
  },
  date: {
    type: Date,
    require: true,
    default: Date.now
  },
  hobby: {
    type: Array,
    default: ['跑步', '听音乐', '羽毛球']
  }
})

userSchema.index({ nickname: 1 })

export default mongoose.model('Users', userSchema)