Hi,
i am using ASP.NET Core with a KENDO Grid which calls a Razor Page handler.
For performance reasons, the Grid is pageable, filterable and sortable.
Now we want the DataSourceRequest on the server to directly filter the MongoDB query. I am using "AsQueryable()" on the IMongoCollection, which i thought works nicely with the KENDO DataSourceResult method.
But the speed of the MongoDB query is always slow. It does not matter if i filter the grid for just one result or if i display all results (paged).
Is this the correct way to use KENDO Grid with MongoDB "database-filtering"?
I am using the following code:
Client
@(Html.Kendo().Grid<PolicyAudit>().Name("PolicyGrid") .Pageable() .Navigatable() .Sortable() .Filterable() .Columns(columBuilder => { columBuilder.Bound(x => x.Orga); columBuilder.Bound(x => x.Operation); columBuilder.Bound(x => x.Ressource); columBuilder.Bound(x => x.TimeStamp); columBuilder.Bound(x => x.UserEmail); columBuilder.Bound(x => x.AccessResult); }) .DataSource(source => source.Ajax() .Read("PolicyOverview", "Policy", new { handler = "ReadPolicyAudits" })))
Server
public async Task<IActionResult> OnPostReadPolicyAudits([DataSourceRequest]DataSourceRequest request) { var access = new PolicyDataAccess(); var col = access.GetCollection<PolicyAudit>("MetaPolicyCollection"); var data = await col.AsQueryable().ToDataSourceResultAsync(request); return new JsonResult(data); }