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 error maxAllowedItems: 50.
I have shared repository link. Please clone the repository and run graphql project and try to run this query
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);
}
}
}
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.
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:
You'll probably also need to adjust the Cost Analysis configuration.
Note that it's generally best not to return more than ~50-100 items at a time, as this can have an impact on memory efficiency (see this comment for more details).
Product
Hot Chocolate
Version
14.3.0
Link to minimal reproduction
https://github.com/Kishan5139/GraphqlPagination
Steps to reproduce
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 error maxAllowedItems: 50.
I have shared repository link. Please clone the repository and run graphql project and try to run this query
Sample MongoDB Document
{ "status": "1", "ProductCode": "Ad12", "ProductName": "asdsad", "ProductTitle": "asfas", "Description": "sadasd", "WebDescription": "asdasdsk", "KeyWords": "sadsadasdday" }
This is my graphql api code
Repo link: https://github.com/Kishan5139/GraphqlPagination
What is expected?
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.
What is actually happening?
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 } }
Relevant log output
Additional context
Hello Team,
CC: @goldytech
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: