mirror of
https://github.com/cnodejs/nodeclub.git
synced 2025-12-08 19:55:55 +00:00
26 lines
619 B
JavaScript
26 lines
619 B
JavaScript
var mongoose = require('mongoose');
|
|
var Schema = mongoose.Schema;
|
|
var ObjectId = Schema.ObjectId;
|
|
|
|
/*
|
|
* type:
|
|
* reply: xx 回复了你的话题
|
|
* reply2: xx 在话题中回复了你
|
|
* follow: xx 关注了你
|
|
* at: xx @了你
|
|
*/
|
|
|
|
var MessageSchema = new Schema({
|
|
type: { type: String },
|
|
master_id: { type: ObjectId},
|
|
author_id: { type: ObjectId },
|
|
topic_id: { type: ObjectId },
|
|
reply_id: { type: ObjectId },
|
|
has_read: { type: Boolean, default: false },
|
|
create_at: { type: Date, default: Date.now }
|
|
});
|
|
|
|
MessageSchema.index({master_id: 1, create_at: -1});
|
|
|
|
mongoose.model('Message', MessageSchema);
|