37 lines
1 KiB
JavaScript
37 lines
1 KiB
JavaScript
const { default: mongoose } = require("mongoose")
|
|
|
|
const favSchema = new mongoose.Schema({
|
|
user_id : {type:String,required: true},
|
|
place_name : String,
|
|
location: {
|
|
type: {
|
|
type: String,
|
|
enum: ['Point'],
|
|
default: 'Point'
|
|
},
|
|
coordinates: {
|
|
type: [Number],
|
|
required: true
|
|
}
|
|
},
|
|
wheelchair_access : String,
|
|
highway_type : String,
|
|
updated_at : {type:Date, default:Date.now}
|
|
})
|
|
|
|
|
|
|
|
module.exports = mongoose.model('favorites',favSchema)
|
|
|
|
//ตัวอย่างข้อมูล
|
|
// {
|
|
// "user_id": "651310bdb59abf1a593e2368",
|
|
// "place_name": "Nonthaburi",
|
|
// "location": {
|
|
// "type": "Point",
|
|
// "coordinates": [100.5212, 13.8593] // ลำดับตำแหน่งแรกเป็นลองจิจูดและตำแหน่งที่สองเป็นละติจูด
|
|
// },
|
|
// "wheelchair_access": "accessible",
|
|
// "highway_type": "expressway"
|
|
// }
|