mirror of
https://github.com/cnodejs/nodeclub.git
synced 2025-12-08 19:55:55 +00:00
加入更多索引
This commit is contained in:
parent
75f601745e
commit
c015274c94
@ -12,7 +12,6 @@ var at = require('../services/at');
|
||||
var User = require('../proxy').User;
|
||||
var Topic = require('../proxy').Topic;
|
||||
var Tag = require('../proxy').Tag;
|
||||
var Relation = require('../proxy').Relation;
|
||||
var TopicTag = require('../proxy').TopicTag;
|
||||
var TopicCollect = require('../proxy').TopicCollect;
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ var ObjectId = Schema.ObjectId;
|
||||
|
||||
var ReplySchema = new Schema({
|
||||
content: { type: String },
|
||||
topic_id: { type: ObjectId, index: true },
|
||||
topic_id: { type: ObjectId},
|
||||
author_id: { type: ObjectId },
|
||||
reply_id : { type: ObjectId },
|
||||
create_at: { type: Date, default: Date.now },
|
||||
@ -12,4 +12,6 @@ var ReplySchema = new Schema({
|
||||
content_is_html: { type: Boolean }
|
||||
});
|
||||
|
||||
ReplySchema.index({topic_id: 1});
|
||||
|
||||
mongoose.model('Reply', ReplySchema);
|
||||
|
||||
@ -3,10 +3,10 @@ var Schema = mongoose.Schema;
|
||||
var config = require('../config').config;
|
||||
|
||||
var UserSchema = new Schema({
|
||||
name: { type: String, index: true },
|
||||
loginname: { type: String, unique: true },
|
||||
name: { type: String},
|
||||
loginname: { type: String},
|
||||
pass: { type: String },
|
||||
email: { type: String, unique: true },
|
||||
email: { type: String},
|
||||
url: { type: String },
|
||||
profile_image_url: {type: String},
|
||||
location: { type: String },
|
||||
@ -14,7 +14,7 @@ var UserSchema = new Schema({
|
||||
profile: { type: String },
|
||||
weibo: { type: String },
|
||||
avatar: { type: String },
|
||||
githubId: { type: String, index: true },
|
||||
githubId: { type: String},
|
||||
githubUsername: {type: String},
|
||||
is_block: {type: Boolean, default: false},
|
||||
|
||||
@ -44,4 +44,10 @@ UserSchema.virtual('avatar_url').get(function () {
|
||||
return url.replace('http://www.gravatar.com/', 'http://cnodegravatar.u.qiniudn.com/');
|
||||
});
|
||||
|
||||
UserSchema.index({name: 1});
|
||||
UserSchema.index({loginname: 1}, {unique: true});
|
||||
UserSchema.index({email: 1}, {unique: true});
|
||||
UserSchema.index({score: -1});
|
||||
UserSchema.index({githubId: 1});
|
||||
|
||||
mongoose.model('User', UserSchema);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user