title: MongoDB w/ Mongoose - Where to put syntax to ensureIndex spanning multiple fields?
body: <p>I'm trying to implement <a href="https://stackoverflow.com/questions/20733805/mongodb-full-text-search-index-error-too-many-text-index-for-why">this solution</a> and I'm not sure where to put it.  I see the db variable called frequently, but I'm still new to node and mongoDb, so I don't know how to call it in my Model.  Here is the syntax to ensure an index spanning multiple fields...</p>
  
  <pre><code>db.collection.ensureIndex( {
      description: "text",
      title: "text"
  } );
  </code></pre>
  
  <p>Here is my model...</p>
  
  <pre><code>    //  Module dependencies.
  var mongoose        = require('mongoose'),
      config          = require('../../config/config'),
      Schema          = mongoose.Schema,
      findOrCreate    = require('mongoose-findorcreate'),
      textSearch      = require('mongoose-text-search');
  
  // Product Schema
  var ProductSchema = new Schema({
      created: {
          type: Date,
          default: Date.now
      },
      retailer: {
          type: String,
          required: true,
          trim: true
      },
      retailer_category: {
          type: String,
          required: true,
          trim: true
      },
      product_id: {
          type: String,
          required: true,
          trim: true
      },
      link: {
          type: String,
          trim: true
      },
      title: {
          type: String,
          trim: true
      },
      price: {
          type: Number
      },
      // Rating - 0 out of 5 (can be decimal)
      rating: {
          type: Number
      },
      description: {
          type: String,
          trim: true
      },
      variations: {
          type: Schema.Types.Mixed,
          default: []
      },
      images: {
          type: Boolean,
          default: false
      }
  }); 
  
  // Validations
  ProductSchema.index({ retailer: 1, product_id: 1 }, { unique: true });
  
  // Statics
  ProductSchema.statics = {
      load: function(id, cb) {
          this.findOne({
              _id: id
          }).exec(cb);
      }
  };
  
  // Plug-Ins
  ProductSchema.plugin(findOrCreate);
  ProductSchema.plugin(textSearch);
  
  mongoose.model('Product', ProductSchema);
  </code></pre>