Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting the collection locally #34

Open
dpatte opened this issue Jul 4, 2016 · 0 comments
Open

Sorting the collection locally #34

dpatte opened this issue Jul 4, 2016 · 0 comments

Comments

@dpatte
Copy link

dpatte commented Jul 4, 2016

My business requirements specifies that my mongo docs should be displayed sorted and paged in a table, where their sort order ignores their case. Unfortunately, sorting while ignoring case, is not supported using the current Mongo publication interface.

So currently, my publication must request the complete collection, unsorted, and I must sort the docs locally, then determine which docs I can display for the page.

I am doing that. I copy the whole unsorted minimongo collection into a reactive array (using observe), then sort, then display the correct portion of that instead, and it works, but:

  • its unfortunately that I am required to publish the complete collection in order to determine which subset of docs to display. I only display 20 docs per page.
  • its also unfortunate that I lose the nice blaze feature that a single doc update only causes the matching displayed doc to be refreshed. Currently, because I am sorting using a reactive array, any displayed doc change causes all my displayed docs to be redisplayed.

Am I missing something? Is there any way I can hook into mongo/minimongo to specify my more specific publication request, and is there any way I can write something that supports blaze's singledoc display optimization, but when using arrays of docs instead of a collection?

As my number of docs in my collection increases, this is becoming more and more critical.

Any suggestions would be handy. THX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant