[Feature Proposal] Compute cursor for each document
See original GitHub issueFeature request & proposal
Highlighting the relay specification for the cursor based pagination which specifies a cursor for each document. As things are today, this library returns pagination metadata as separate fields (next
, previous
, etc…) which points to the last document of the list.
I propose to add an additional field _cursor
for each document which will allow the user to move in forward/backward direction from any node in a list.
Example -
{
"results":
[
{
" _id" : "580fd16aca2a6b271562d8bb",
"counter": 4,
"_cursor": "eyIkb2lkIjoiNTgwZmQxNmFjYTJhNmIyNzE1NjJkOGJiIn0" },
{
" _id": "580fd16aca2a6b271562d8ba",
"counter": 3,
"_cursor": "eyIkb2lkIjoiNTgwZmQxNmFjYTJhNmIyNzE1NjJkOGJhIn0"
}
],
"next": "eyIkb2lkIjoiNTgwZmQxNmFjYTJhNmIyNzE1NjJkOGJhIn0",
"hasNext": "true"
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:18 (6 by maintainers)
Top Results From Across the Web
Issues · mixmaxhq/mongo-cursor-pagination - GitHub
Contribute to mixmaxhq/mongo-cursor-pagination development by creating an account on GitHub. ... [Feature Proposal] Compute cursor for each document.
Read more >cursor.forEach() — MongoDB Manual
Iterates the cursor to apply a JavaScript function to each document from the cursor. The forEach() method has the following prototype form: db.collection....
Read more >cursor – Tools for iterating over MongoDB query results
Cursor class to iterate over Mongo query results. ... The tailable cursor type. Tailable cursors are only for use with capped collections. They...
Read more >15 Improving Real-World Performance Through Cursor Sharing
The adaptive cursor sharing feature enables a single statement that contains bind variables to use multiple execution plans. Cursor sharing is "adaptive" ...
Read more >Performance and Resource Utilization - Amazon DocumentDB
How Do I Find and Terminate Long Running or Blocked Queries? How Can I See a Query Plan and Optimize a Query? How...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This library doesn’t provide a way to get a total count. I don’t think we’d want that - even if it was opt-in-only - given the performance cost of running such query.
Yes, sounds useful. I’d accept a PR. Perhaps for now make it an option?