mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 10:56:53 -05:00
Add Classroom, Clan, and Achievement indexes. Fix logging for undefined slugs indentation.
This commit is contained in:
parent
b3edafe285
commit
e3db0dea3a
4 changed files with 9 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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) ->
|
||||
|
|
Loading…
Reference in a new issue