diff --git a/server/articles/Article.coffee b/server/articles/Article.coffee index 79acdebfb..0b69ceec0 100644 --- a/server/articles/Article.coffee +++ b/server/articles/Article.coffee @@ -1,7 +1,7 @@ mongoose = require 'mongoose' plugins = require '../plugins/plugins' -ArticleSchema = new mongoose.Schema(body: String, {strict: false}) +ArticleSchema = new mongoose.Schema(body: String, {strict: false,read:'nearest'}) ArticleSchema.index( { diff --git a/server/campaigns/Campaign.coffee b/server/campaigns/Campaign.coffee index 35e218971..b48ec0b1a 100644 --- a/server/campaigns/Campaign.coffee +++ b/server/campaigns/Campaign.coffee @@ -2,7 +2,7 @@ mongoose = require 'mongoose' plugins = require '../plugins/plugins' log = require 'winston' -CampaignSchema = new mongoose.Schema(body: String, {strict: false}) +CampaignSchema = new mongoose.Schema(body: String, {strict: false,read:'nearest'}) CampaignSchema.index({i18nCoverage: 1}, {name: 'translation coverage index', sparse: true}) CampaignSchema.index({slug: 1}, {name: 'slug index', sparse: true, unique: true}) diff --git a/server/commons/database.coffee b/server/commons/database.coffee index 13a485ab4..18e8248fe 100644 --- a/server/commons/database.coffee +++ b/server/commons/database.coffee @@ -21,7 +21,9 @@ module.exports.connect = () -> mongooseCache.install(mongoose, {max: 200, maxAge: 1 * 60 * 1000, debug: false}, Aggregate) module.exports.generateMongoConnectionString = -> - if not testing and config.mongo.mongoose_replica_string + if not testing and config.tokyo + address = config.mongo.mongoose_tokyo_replica_string + else if not testing and config.mongo.mongoose_replica_string address = config.mongo.mongoose_replica_string else dbName = config.mongo.db diff --git a/server/levels/Level.coffee b/server/levels/Level.coffee index b27264615..29924522a 100644 --- a/server/levels/Level.coffee +++ b/server/levels/Level.coffee @@ -4,7 +4,7 @@ jsonschema = require '../../app/schemas/models/level' LevelSchema = new mongoose.Schema({ description: String -}, {strict: false}) +}, {strict: false, read:'nearest'}) LevelSchema.index( { diff --git a/server/levels/components/LevelComponent.coffee b/server/levels/components/LevelComponent.coffee index 46f36822f..3404ca6f6 100644 --- a/server/levels/components/LevelComponent.coffee +++ b/server/levels/components/LevelComponent.coffee @@ -5,7 +5,7 @@ jsonschema = require '../../../app/schemas/models/level_component' LevelComponentSchema = new mongoose.Schema { description: String system: String -}, {strict: false} +}, {strict: false, read:'nearest'} LevelComponentSchema.index( { diff --git a/server/levels/sessions/LevelSession.coffee b/server/levels/sessions/LevelSession.coffee index d45f167a7..74769ee89 100644 --- a/server/levels/sessions/LevelSession.coffee +++ b/server/levels/sessions/LevelSession.coffee @@ -8,7 +8,7 @@ LevelSessionSchema = new mongoose.Schema({ created: type: Date 'default': Date.now -}, {strict: false}) +}, {strict: false,read:'nearest'}) LevelSessionSchema.index({creator: 1}) LevelSessionSchema.index({level: 1}) diff --git a/server/levels/systems/LevelSystem.coffee b/server/levels/systems/LevelSystem.coffee index 0b0279baa..5d3830f5e 100644 --- a/server/levels/systems/LevelSystem.coffee +++ b/server/levels/systems/LevelSystem.coffee @@ -4,7 +4,7 @@ jsonschema = require '../../../app/schemas/models/level_system' LevelSystemSchema = new mongoose.Schema { description: String -}, {strict: false} +}, {strict: false,read:'nearest'} LevelSystemSchema.index( { diff --git a/server/levels/thangs/ThangType.coffee b/server/levels/thangs/ThangType.coffee index 605cb97a9..973ecfcdd 100644 --- a/server/levels/thangs/ThangType.coffee +++ b/server/levels/thangs/ThangType.coffee @@ -3,7 +3,7 @@ plugins = require '../../plugins/plugins' ThangTypeSchema = new mongoose.Schema({ body: String, -}, {strict: false}) +}, {strict: false,read:'nearest'}) ThangTypeSchema.index( { diff --git a/server_config.coffee b/server_config.coffee index 3d9fd2e43..008c93422 100644 --- a/server_config.coffee +++ b/server_config.coffee @@ -2,6 +2,7 @@ config = {} config.unittest = process.argv.indexOf('--unittest') > -1 +config.tokyo = process.env.TOKYO or false config.port = process.env.COCO_PORT or process.env.COCO_NODE_PORT or 3000 config.ssl_port = process.env.COCO_SSL_PORT or process.env.COCO_SSL_NODE_PORT or 3443 config.cloudflare = @@ -16,6 +17,7 @@ config.mongo = host: process.env.COCO_MONGO_HOST or 'localhost' db: process.env.COCO_MONGO_DATABASE_NAME or 'coco' mongoose_replica_string: process.env.COCO_MONGO_MONGOOSE_REPLICA_STRING or '' + mongoose_tokyo_replica_string: process.env.COCO_MONGO_MONGOOSE_TOKYO_REPLICA_STRING or '' config.apple = verifyURL: process.env.COCO_APPLE_VERIFY_URL or 'https://sandbox.itunes.apple.com/verifyReceipt'