Add Classroom, Clan, and Achievement indexes. Fix logging for undefined slugs indentation.

This commit is contained in:
Nick Winter 2015-12-03 11:15:34 -08:00
parent b3edafe285
commit e3db0dea3a
4 changed files with 9 additions and 3 deletions

View file

@ -31,6 +31,7 @@ AchievementSchema.index(
})
AchievementSchema.index({i18nCoverage: 1}, {name: 'translation coverage index', sparse: true})
AchievementSchema.index({slug: 1}, {name: 'slug index', sparse: true, unique: true})
AchievementSchema.index({related: 1}, {name: 'related index', sparse: true})
AchievementSchema.methods.objectifyQuery = ->
try

View file

@ -7,6 +7,7 @@ CampaignSchema = new mongoose.Schema(body: String, {strict: false,read:config.mo
CampaignSchema.index({i18nCoverage: 1}, {name: 'translation coverage index', sparse: true})
CampaignSchema.index({slug: 1}, {name: 'slug index', sparse: true, unique: true})
CampaignSchema.index({type: 1}, {name: 'type index', sparse: true})
CampaignSchema.plugin(plugins.NamedPlugin)
CampaignSchema.plugin(plugins.TranslationCoveragePlugin)

View file

@ -7,6 +7,10 @@ jsonSchema = require '../../app/schemas/models/classroom.schema'
ClassroomSchema = new mongoose.Schema {}, {strict: false, minimize: false, read:config.mongo.readpref}
ClassroomSchema.index({ownerID: 1}, {name: 'ownerID index'})
ClassroomSchema.index({members: 1}, {name: 'members index'})
ClassroomSchema.index({code: 1}, {name: 'code index', unique: true})
ClassroomSchema.statics.privateProperties = []
ClassroomSchema.statics.editableProperties = [
'description'

View file

@ -501,9 +501,9 @@ module.exports = class Handler
if Handler.isID(idOrSlug)
query = @modelClass.findById(idOrSlug)
else
if not idOrSlug or idOrSlug is 'undefined'
console.error "What? Why are we fetching the slug: #{idOrSlug}?"
console.trace()
if not idOrSlug or idOrSlug is 'undefined'
console.error "What? Why are we fetching the slug: #{idOrSlug}?"
console.trace()
query = @modelClass.findOne {slug: idOrSlug}
query.select projection if projection
query.exec (err, document) ->