Skip to content

Instantly share code, notes, and snippets.

@jiangzhuo
Created December 20, 2012 06:23
Show Gist options
  • Save jiangzhuo/4343299 to your computer and use it in GitHub Desktop.
Save jiangzhuo/4343299 to your computer and use it in GitHub Desktop.
public IEnumerable<T> MapReduce(Expression<Func<T, bool>> predicate,string mapString,string reduceString)
{
var query = ((MongoQueryable<T>)this.collection.AsQueryable<T>().Where(predicate)).GetMongoQuery();
var mrResult = this.collection.MapReduce(query, new BsonJavaScript(mapString), new BsonJavaScript(reduceString));
return mrResult.GetInlineResultsAs<T>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment