question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for cursor based pagination

See original GitHub issue

Hi,

how can I use cursor based pagination (page=page, per_page=…) with your library ? I can’t modify the mongo request using something like this:

def resolve_users(self, info):
    	return list(UserModel.objects.find({...}).sort(...).limit(limit))

because then I get 'QuerySet' object has no attribute 'find'

Please provide information regarding this functionality or implement this feature.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
mpgalaxycommented, Sep 12, 2019

Hi, thank you very much, you really helped me a lot. I think I can close this issue now. 😉

1reaction
stefanvanburencommented, Sep 5, 2019

I don’t have a great answer for you for flask / 404s; typically in GraphQL rather than setting a HTTP response code you’ll populate the errors dict, and I’d imagine the flask mutations wouldn’t be so far from the other examples.

For sorting, you can use order_by to sort:

return list(UserModel.objects(user_id__gte=last_id).order_by(...).limit(per_page))

good luck!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Evolving API Pagination at Slack
Cursor -based pagination works by returning a pointer to a specific item in the dataset. On subsequent requests, the server returns results after...
Read more >
Cursor-based pagination - Apollo GraphQL Docs
Relay-style cursor pagination. The InMemoryCache field policy API allows for any conceivable style of pagination, even though some of the simpler approaches ...
Read more >
How to Implement Cursor Pagination Like a Pro - Medium
If offset pagination is an array, then cursor pagination is a linked list. Where offset grabs records based on where they are located...
Read more >
Secret scanning's REST API endpoints now support cursor ...
GitHub Advanced Security customers can now use cursors to paginate over alert results they retrieve via the repository and organization level ...
Read more >
A deep dive into cursor-based pagination in MongoDB
Instead of skipping results to move across pages, cursor-based pagination lets us use a record as a pointer (this is called the cursor)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found