MiGration Scripts




A Simple Show and Tell Lighting Talk

Goals




  • Short review
  • Show a migration script with aggregation
  • Talk about Migration scripts

Migration Strategies


  • Feature Switches
  • Migration Scripts
  • Pay As You Go
  • Versioning

Aggregation Framework



A means to calculate aggregated values
without using map-reduce

The Pieces


  • Pipeline
    • Pipes objects through a unix pipe like fashion
  • Expressions
    • Similar to SQL statements - allows document manipulation and calculations



Implementations are done with the Mongo Ruby Driver

Your examples may look different or you might use
ORMs like Mongoid or MongoMapper (Ruby)

The Code

cmd = { aggregate: 'assessments',
        pipeline: [
          {
            '$project' => {
              :_id => 0,
              :user_id => 1,
              :organization_id => 1,
              :assessment_id => "$_id",
              :supplemental_question_ids => 1,
              :question_ids => 1,
              :response_count => 1,
              :date => 1,
              :end_date => 1,
              :released => 1,
              :viewing_key => 1,
            }
          }
        ]
      }

MiGration Scripts

By Jason Wieringa

MiGration Scripts

  • 1,204