.net - How to use predicate search using Mongodb C# Driver -


how 1 use following method on awesome mongodb c# driver!????

public ilist<tentity>searchfor(expression<func<tentity, bool>> predicate)             {                 return collection                     .asqueryable<tentity>()                         .where(predicate.compile())                             .tolist();             } 

examples ideal!

simply remove compile because creates delegate driver can't translate mongo query:

public ilist<tentity>searchfor(expression<func<tentity, bool>> predicate) {     return collection         .asqueryable<tentity>()             .where(predicate)                 .tolist(); } 

it means predicate expression must translatable mongodb driver.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -