Reputation: 8214
Given this wrapper:
public MongoCollection<TEntity> GetQuery<TEntity>() where TEntity : class
{
var query = DataBase.GetCollection<TEntity>(typeof(TEntity).Name + "s");
return query;
}
public long Count<TEntity>(System.Linq.Expressions.Expression<Func<TEntity, bool>> criteria) where TEntity : class
{
return this.GetQuery<TEntity>().AsQueryable().Count(criteria);
}
If I call Count(), will the query be performed on the server as stated in the documentation here?
var count = db<MyEntity>.Count(x => x.Foo = "foo");
Upvotes: 3
Views: 555
Reputation: 12624
Yes. It will get executed server-side. You can verify this by turning the profiling up on your mongodb server and seeing what gets executed.
Upvotes: 3