dburles / dburles/meteor-collection-helpers

Idea: access parent cursor in doc helpers

Open
#40 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
495
Forks
33
PR merge metrics
No merged PRs in 30d

Description

That would be pretty useful to be able to access the parent cursor from a document returned to the helpers method, and in particuler its previous / next docs in the cursor.

That would make things like grouping elements by an attribute very clean. Examples: for a chat app where you would need to insert a separator for each day, a contacts list where you need to group people by the first letter of their names, etc.

The code could look like this:

``` javascript
Messages.helpers({
'$newDay': funtion(prev, next) {
return (!prev || (this.day !== prev.day)) ? this.day : null;
}
});
```

Haven't been able to dig into minimongo yet - but @dburles do you think this is something that can be done?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.