-
Notifications
You must be signed in to change notification settings - Fork 8
/
landmark_schema.js
75 lines (69 loc) · 1.54 KB
/
landmark_schema.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
var mongoose = require('mongoose'),
textSearch = require('mongoose-text-search');
monguurl = require('monguurl');
//schema construction
var Schema = mongoose.Schema, ObjectID = Schema.ObjectID;
var landmarkSchema = new Schema({
name: String,
description: String,
shortDescription: String,
type: String,
subType: String,
category: String,
searchField: String,
id: String,
loc: {type: [Number], index:'2d'}, //indexing
mapID: String,
time: {
created: { type: Date, default: Date.now },
start: { type: Date},
end: { type: Date}
},
timetext: {
datestart: String,
dateend: String,
timestart: String,
timeend: String
},
stats: {
avatar: String,
level: Number,
reputation: Number,
likes: Number,
buzz: Number,
checkIn: [String],
imGoing: [String],
},
insides: {
mapURL: String,
mapID: String
},
video: String,
etherpad: String,
loc_nicknames : [String],
loc_nicknames_stripe : [String],
tags: String,
permissions: {
hidden: Boolean,
viewers: [String],
openedit: Boolean,
admins: [String]
},
feed: [String]
},
{_id: false}); //not writing _id let mongo kk
landmarkSchema.plugin(textSearch);
//indexing for search
landmarkSchema.index({
name :"text",
description :"text",
shortDescription :"text",
type :"text",
loc_nicknames :"text"
});
// landmarkSchema.plugin(monguurl({
// length: 40,
// source: 'name',
// target: 'id'
// }));
module.exports = landmarkSchema;