Skip to content

Data Loading Rebuild

Choose a tag to compare

@mxriverlynn mxriverlynn released this 19 Mar 20:09
· 6 commits to master since this release

MAJOR BREAKING CHANGE

This version of Migroose includes a major breaking change in the way data loading works. Previously, the load steps would return a MongooseJS model for the data in question. Now, the returned structure will include a .collection for the raw MongoDB collection object, and a .documents as an array of the documents from the collection.

migration.load({
  someData: "somecollection"
});

migration.step(function(data, complete){

  // the mongodb collection
  var col = data.someData.collection;

  // the array of documents from the collection
  var docs = data.someData.documents;

  // ... do work
  complete();
});

If you are upgrading from a previous release of Migroose, you will need to upgrade your old scripts to work from this new structure. Failing to update your migrations will cause them to error when they run.