Setting up read preferences and china specific configuration

This commit is contained in:
Michael Schmatz 2015-03-19 14:18:38 -04:00
parent aae44c2064
commit 7f9301e8c6
9 changed files with 12 additions and 8 deletions

View file

@ -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(
{

View file

@ -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})

View file

@ -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

View file

@ -4,7 +4,7 @@ jsonschema = require '../../app/schemas/models/level'
LevelSchema = new mongoose.Schema({
description: String
}, {strict: false})
}, {strict: false, read:'nearest'})
LevelSchema.index(
{

View file

@ -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(
{

View file

@ -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})

View file

@ -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(
{

View file

@ -3,7 +3,7 @@ plugins = require '../../plugins/plugins'
ThangTypeSchema = new mongoose.Schema({
body: String,
}, {strict: false})
}, {strict: false,read:'nearest'})
ThangTypeSchema.index(
{

View file

@ -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'