You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’ve implemented GraphQL in my project and I'm encountering an issue with cursor-based pagination. When I try to fetch more than 50 records using first: 51 or higher, I receive the following error:
using GraphQLPagination.ApiService.Models;
using MongoDB.Driver;
namespace SupplierEngine.GraphQLServer.GraphQL.Laltex.Queries
{
public class PIMCoreLaltexSupplierQueries(IMongoDatabase _mongoDatabase) : IPIMCoreLaltexSupplierQueries
{
private IMongoCollection<Suppliers> GetUserLaltexCollection(string userID, bool IsUpdateCall)
{
if (string.IsNullOrEmpty(userID))
{
throw new UnauthorizedAccessException("User ID is not found.");
}
var collectionName = IsUpdateCall ? $"laltex_{userID}_updated" : $"laltex_{userID}";
return _mongoDatabase.GetCollection<Suppliers>(collectionName);
}
public IQueryable<Suppliers> GetLaltexPimCoreSupplierData(string UserID, bool IsUpdateCall, int page, int pageSize)
{
return GetUserLaltexCollection(UserID, IsUpdateCall).AsQueryable()
.OrderBy(x => x.ItemCodeProductCode);
}
}
}
Question:
Is there a way to increase the maximum first value allowed in a cursor-based pagination query using Hot Chocolate GraphQL?
I want to be able to fetch up to 1000 records per page, as my MongoDB collection contains over 18,000 documents.
Please advise on how to configure the maximum allowed page size on the server side.
Thanks in advance for your help!
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Hello Team,
CC: @goldytech
I’ve implemented GraphQL in my project and I'm encountering an issue with cursor-based pagination. When I try to fetch more than 50 records using first: 51 or higher, I receive the following error:
Error Response:
{ "errors": [ { "message": "The maximum allowed items per page were exceeded.", "locations": [ { "line": 2, "column": 3 } ], "path": [ "laltexPimCoreSupplierData" ], "extensions": { "code": "HC0051", "fieldCoordinate": "QueriesResolver.laltexPimCoreSupplierData", "requestedItems": 51, "maxAllowedItems": 50 } } ], "data": { "laltexPimCoreSupplierData": null } }
Here is my Graphql Query
Sample MongoDB Document
{ "status": "1", "ProductCode": "Ad12", "ProductName": "asdsad", "ProductTitle": "asfas", "Description": "sadasd", "WebDescription": "asdasdsk", "KeyWords": "sadsadasdday" }
This is my graphql api code
I have created a sample project which you can use to reproduce the issue. Here is my repository link.
https://github.com/Kishan5139/GraphqlPagination
Question:
Is there a way to increase the maximum first value allowed in a cursor-based pagination query using Hot Chocolate GraphQL?
I want to be able to fetch up to 1000 records per page, as my MongoDB collection contains over 18,000 documents.
Please advise on how to configure the maximum allowed page size on the server side.
Thanks in advance for your help!
The text was updated successfully, but these errors were encountered: