'use strict';

module.exports = function (mongoose) {
  var recallSchema = mongoose.Schema({
    Year: Number,
    Make: String,
    Model: String,
    Manufacturer: String,
    Component: String,
    Summary: String,
    Consequence: String,
    Remedy: String,
    Notes: String,
    NHTSACampaignNumber: String,
    ReportReceivedDate: String
  });
  mongoose.model('Recall', recallSchema);
};

'use strict';

module.exports = function (mongoose) {
  var recallSchema = mongoose.Schema({
    Year: { type: Number, index: true },
    Make: { type: String, index: true },
    Model: { type: String, index: true },
    Manufacturer: String,
    Component: String,
    Summary: String,
    Consequence: String,
    Remedy: String,
    Notes: String,
    NHTSACampaignNumber: String,
    ReportReceivedDate: String
  });
  recallSchema.set('autoIndex', false);
  recallSchema.index({ Year: 1, Make: 1, Model: 1 });
  mongoose.model('Recall', recallSchema);
};

Add indexes to Recall schema
Add indexes to Recall schema

* Sorting the data and attempting to access tail results would result in
a buffer overrun error. Indexes were missing from the schema and have
now been added.
