Skip to content

Conversation

@cartant
Copy link
Contributor

@cartant cartant commented Feb 11, 2017

Checklist

Description

This PR introduces support for the optional key parameter that can be passed to the SDK's startAt method. According to the SDK documentation, the parameter is "allowed if ordering by child, value, or priority".

There was some discussion in the linked (and closed) issue regarding the key parameter only being supported and useful when ordering by priority, but the documentation suggests that it is also supported - by startAt - when ordering by child and value. Indeed, were it not to be supported, it would not be possible to reliably page through lists that are ordered by child when there are large numbers of items with the same child value. This is an issue that I currently have with an implementation of a FirebaseListObservable-based infinite list.

There is a plunk here that demonstrates the use of key with the SDK to page when ordering by child.

Code sample

The key parameter is really only useful when paging through results, so this code sample is contrived and not particularly sensible:

let list = angularFire.database.list('some/data', {
  query: {
    orderByChild: 'some-child',
    startAt: { value: 'some-value', key: 'some-key' },
    limitToFirst: 10
  }
});

@cartant
Copy link
Contributor Author

cartant commented Feb 11, 2017

PS. This PR has no breaking changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants