More read nearests and changed redirection

This commit is contained in:
Michael Schmatz 2015-03-20 16:33:03 -04:00
parent d8c21771fc
commit 5a7666fca3
9 changed files with 9 additions and 9 deletions

View file

@ -13,7 +13,7 @@ TreemaUtils = require '../../bower_components/treema/treema-utils.js'
AchievementSchema = new mongoose.Schema({
userField: String
}, {strict: false})
}, {strict: false,read:'nearest'})
AchievementSchema.index(
{

View file

@ -8,7 +8,7 @@ LevelFeedbackSchema = new mongoose.Schema({
created:
type: Date
'default': Date.now
}, {strict: false})
}, {strict: false,read:'nearest'})
LevelFeedbackSchema.index({created: 1})
LevelFeedbackSchema.index({creator: 1})

View file

@ -3,7 +3,7 @@ deltas = require '../../app/core/deltas'
log = require 'winston'
{handlers} = require '../commons/mapping'
PatchSchema = new mongoose.Schema({status: String}, {strict: false})
PatchSchema = new mongoose.Schema({status: String}, {strict: false,read:'nearest'})
PatchSchema.pre 'save', (next) ->
return next() unless @isNew # patch can't be altered after creation, so only need to check data once

View file

@ -1,6 +1,6 @@
mongoose = require('mongoose')
PaymentSchema = new mongoose.Schema({}, {strict: false})
PaymentSchema = new mongoose.Schema({}, {strict: false, read:'nearest'})
PaymentSchema.index({recipient: 1, 'stripe.timestamp': 1, 'ios.transactionID'}, {unique: true, name: 'unique payment'})
module.exports = mongoose.model('payment', PaymentSchema)

View file

@ -7,7 +7,7 @@ PollSchema = new mongoose.Schema {
created:
type: Date
'default': Date.now
}, {strict: false, minimize: false}
}, {strict: false, minimize: false,read:'nearest'}
PollSchema.index {priority: 1}

View file

@ -1,5 +1,5 @@
mongoose = require 'mongoose'
PrepaidSchema = new mongoose.Schema {}, {strict: false, minimize: false}
PrepaidSchema = new mongoose.Schema {}, {strict: false, minimize: false,read:'nearest'}
module.exports = Prepaid = mongoose.model('prepaid', PrepaidSchema)

View file

@ -1,6 +1,6 @@
mongoose = require('mongoose')
PurchaseSchema = new mongoose.Schema({status: String}, {strict: false})
PurchaseSchema = new mongoose.Schema({status: String}, {strict: false,read:'nearest'})
PurchaseSchema.index({recipient: 1, 'purchased.original': 1}, {unique: true, name: 'unique purchase'})
module.exports = mongoose.model('purchase', PurchaseSchema)

View file

@ -5,6 +5,6 @@ UserCodeProblemSchema = new mongoose.Schema({
created:
type: Date
'default': Date.now
}, {strict: false})
}, {strict: false,read:'nearest'})
module.exports = UserCodeProblem = mongoose.model('user.code.problem', UserCodeProblemSchema)

View file

@ -88,7 +88,7 @@ setupChinaRedirectMiddleware = (app) ->
isChinese = firstAcceptedLanguage.indexOf? "zh"
return isChinese? and isChinese isnt -1
else
return true
return false #If the user is already redirected, don't redirect them!
app.use (req, res, next) ->
if isInChina req