Skip to content

Instantly share code, notes, and snippets.

@ronfe
Last active April 17, 2016 00:19
Show Gist options
  • Save ronfe/c98a9f8f32572622d7acfbacf5616192 to your computer and use it in GitHub Desktop.
Save ronfe/c98a9f8f32572622d7acfbacf5616192 to your computer and use it in GitHub Desktop.
event35Schema = new Schema({
"eventKey": {type: String, required: true},
"eventValue": {type: Mixed},
"device": String, //Required, unique id for pc, imei for android, idfa for ios
"deviceOld": String,
"deviceAttr": {
"os": {
"name": {type: String}, //Required, operating system name macos/linux/win for pc, android/ios/win for mobile
"version": String //Conditional optional, os version code
},
"model": { //App conditional optional, mobile model information
"brand": String ,
"name": String
},
"appVersion": String
},
"ua": String,
"url": String, //only for pc, the full url
"channel": String,
"category": {type: String, required: true, enum: ["site", "course", "video", "problem"]}, // to string
"platform": {type: String, enum: ["web", "app", "share", "m", "promotion", "vs"]}, //Required
"os": {type: String, enum: ["pc", "android", "ios"]},
"ip": String,
"location": {type: Mixed},
"user": ObjectId, //Required when user logged in, its user id
"role": {"type": String, "enum": ["teacher", "student", "editor", "visitor"]},
"eventTime": {type: Number, required: true}, //Required, timeStamp of points generated, unix epoch time (in ms)
"serverTime": {type: Date, default: Date.now} //Server required, Time recorded by server
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment