title: Text search whitespace escape
body: <p>I'm using nodeJs Mongoose to perform text search;</p>
  
  <pre><code>var mongoose = require('mongoose');
  var config = require('../config');
  var mongoosePaginate = require('mongoose-paginate'); 
  var poiSchema = mongoose.Schema({
      city:String,
      cap:String,
      country:String,
      address: String,
      description: String,
      latitude: Number,
      longitude: Number,
      title: String,
      url: String,
      images:Array,
      freeText:String,
      owner:String,
  });
  poiSchema.index({'$**': 'text'});
  
  poiSchema.plugin(mongoosePaginate);
  mongoose.Promise = global.Promise;
  mongoose.connect(config.database);
  module.exports = mongoose.model('Poi', poiSchema);
  </code></pre>
  
  <p>As you can see here</p>
  
  <pre><code>poiSchema.index({'$**': 'text'});
  </code></pre>
  
  <p>I create a text index on every field inside my schema.</p>
  
  <p>When I try to perform a text search, I develop this code:</p>
  
  <pre><code>var term = "a search term";
  
  var query = {'$text':{'$search': term}};
  Poi.paginate(query, {}, function(err, pois) {
      if(!pois){
          pois = {
              docs:[],
              total:0
          };
      }
      res.json({search:pois.docs,total:pois.total});
  });
  </code></pre>
  
  <p>Unfortunately, when I use whitespace inside term search, it will fetch all documents inside the collection that matches every single field inside term search split by whitespace.</p>
  
  <p>I imagine that text index has as tokenizer whitespace;</p>
  
  <p>I need to know how to escape whitespace in order to search every field that has the entire term search without splitting it.</p>
  
  <p>I tried replacing whitespace with <code>\\</code> but nothing changes.</p>
  
  <p>Could please someone help me? </p>