-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy pathlocation.js
53 lines (50 loc) · 1 KB
/
location.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var winston = require('../config/winston');
var LocationSchema = new Schema({
country: {
type: String,
required: false,
index: true
},
city: {
type: String,
required: false,
index: true
},
streetAddress: {
type: String,
required: false,
index: true
},
region: {
type: String,
required: false,
index: true
},
zipcode: {
type: String,
required: false,
index: true
},
ipAddress: {
type: String,
required: false,
index: true
},
// https://mongoosejs.com/docs/geojson.html
geometry: {
type: {
type: String, // Don't do `{ location: { type: String } }`
enum: ['Point'], // 'location.type' must be 'Point'
required: false
},
coordinates: {
type: [Number],
required: false
},
// index: '2dsphere' // Create a special 2dsphere index on `City.location`
}
},{ _id : false }
);
module.exports = LocationSchema;