title: MongoDB C# Using custom extensions in Linq or Lambda Query, for checking string similarity
body: <p>I'm trying to get from Mongo collection only that "x.SystemName" is similar at 80% to input string. It works when i load all entries from collection to variable, but i want to get results directly from database.</p>
  
  <p>This code works:</p>
  
  <pre><code>IEnumerable&lt;Company&gt; companies = await FindAllCompanies();
  IEnumerable&lt;Company&gt; _dbresult = (from company in companies
                                             where company.SystemName.StringRateSimilarity(inputSystemName) &gt;= 0.8 || company.SystemName.Contains(inputSystemName) || company.Name.ToLowerInvariant().Contains(name.ToLowerInvariant())
                                             select company);
  </code></pre>
  
  <p>But i want to make it like this without previously loading all Companies to variable:</p>
  
  <pre><code>IEnumerable&lt;Company&gt; _dbresult = (from company in _db.DatabaseHost.GetCollection&lt;Company&gt;(collectionName).AsQueryable()
                                             where company.SystemName.StringRateSimilarity(inputSystemName) &gt;= 0.8 || company.SystemName.Contains(inputSystemName) || company.Name.ToLowerInvariant().Contains(name.ToLowerInvariant())
                                             select company);
  </code></pre>
  
  <p>or like this:</p>
  
  <pre><code>var collection = _db.DatabaseHost.GetCollection&lt;Company&gt;(collectionName);
  IEnumerable&lt;Company&gt; _dbresult = collection.AsQueryable().Where(x =&gt; (Services.API.StringRateSimilarity(x.SystemName, inputSystemName) &gt;= 0.8) || (x.SystemName.Contains(inputSystemName)) || (x.Name.ToLowerInvariant().Contains(name.ToLowerInvariant()))).Select(e =&gt; e);
  </code></pre>
  
  <p>But this make <i>InvalidOperationException: StringRateSimilarity({document}{systemName}, "TEST") is not supported.</i> Error</p>