title: Removing white spaces (leading and trailing) from string value
body: <p>I have imported a csv file in mongo using mongoimport and I want to remove leading and trailing white spaces from my string value.</p>
  
  <p>Is it possible directly in mongo to use a trim function for all collection or do I need to write a script for that?</p>
  
  <p>My collection contains elements such as:</p>
  
  <pre><code>{
    "_id" : ObjectId("53857680f7b2eb611e843a32"),
    "category" : "Financial &amp; Legal Services "
  }
  </code></pre>
  
  <p>I want to apply trim function for all the collection so that <code>"category"</code> should not contain any leading and trailing spaces.</p>