How to call GraphQL API through Realm framework?

Hello,

How to call GraphQL API through MongoDB realm framework??

If Apollo Client framework is the solution then How can we manage pagination(limit and offset).

Thanks in advance.

2 Likes

@Vishal_Deshai Yes I would use the Apollo client to connect to the GraphQL API. You can send the limit operator in a GraphQL query just as you normally would - Introduction to Apollo iOS - Apollo GraphQL Docs

query {
  movies(
    query: { year: 2000 }
    sortBy: RUNTIME_DESC
    limit: 10
  ) {
    _id
    title
    year
    runtime
  }
}
1 Like

Hello,

Thanks for the answer.

first 10 records are fetch then next time we need 11 to 20 records(Next 10).

Thanks

Hi

Waiting for your positive feedback.

Let me repeat my query. How can we get next 10 records(i.e. 11 to 20) if page size is 10.

Thanks.

1 Like

Hi Vishal,

You will have to use find() and limit() to implement this with custom resolvers.

Any chance this could be a feature? Doing a custom resolver doesn’t make the use as dynamic and you need keep track of more and more functions.

updateMany etc are features for example. Count, Skip and Next are features at AWS and Dgraph.

2 Likes

I completely agree. I would expect proper pagination handling to be built into any GraphQL API. It’s hard to believe this still hasn’t been implemented on MongoDB when it’s fairly common in other GraphQL APIs.

There is a feature request here that’s worth voting on.

1 Like

+1
It’s so sad that there is zero progress on this. I guess, AWS AppSync or using DGraph are our only options.