-
Notifications
You must be signed in to change notification settings - Fork 2.2k
startAt to support key #1114
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
Comments
@bob-lee I'm in support of this, but to be honest I don't have the time to implement it. However, if you'd like to send in the PR I'd be more than happy to provide guidance and review. Let me know if you're interested! |
@davideast Absolutely I am in. Where can I start? |
@davideast there was a PR #821 merged last Feb but that doesn't seem to help the situation. As a first step, I forked and tried
|
I realized I was mistakenly using this.notes = this.db.list(`notes`, {
query: {
orderByChild: 'group',
//equalTo: 'Issues',
limitToFirst: 2,
startAt: { value: 'Issues', key: '-KqFzkJy-DCM7mmH3jo5' }
}
}); So PR #821 was doing its job ok but now the result is not guaranteed to contain only notes under 'Issues' group due to a missing Just for test, I included
This seems to be a fundamental limitation in BTW, I could run //const { spawn } = require('child_process');
const { spawn } = require('cross-spawn'); // to build on Windows machine |
Ran into this limitation of Firebase myself and solved it by adding composite keys to everything. Let's say you'd have:
Then you can:
Got a cloud function triggered by a push to these lists, which adds the composite keys like Let's say you also have a relation to a user, just add a composite key These what we might call limitations compared to SQL can be advantages, once you manage to forget all you know about SQL and start thinking Firebase way. It's what makes FB so freaking fast and scalable. Sorry this got out of the scope of github issues. =) Huge thanks to @davideast for work like this to make it easier to learn this stuff: https://github.com/davideast/Querybase |
@bob-lee Not a problem in the new API which allows you to formulate a query using a callback. Check out the new docs! |
Version info
Angular: 4.3.5
Firebase: 4.3.0
AngularFire: 4.0.0-rc.2
Other (e.g. Ionic/Cordova, Node, browser, operating system): Chrome 60, Windows 7
How to reproduce these conditions
Failing test unit, Plunkr, or JSFiddle demonstrating the problem
Steps to set up and reproduce
Have read a bit old issue #362 but I am raising here again with some info. For pagination, I need to use
startAt
with optionalkey
combined withorderByChild
.To emulate the behavior that gets the next page content, I ran below code with some hard coded values found in my
notes
database and it gives me what I expected - two notes under 'Issues' group starting with the one with given key:But if run below code, I got nothing:
If I comment out
startAt
line above, it gives me first two notes under 'Issues' group.Sample data and security rules
<-- include/attach/link to some json sample data (or provide credentials to a sanitized, test Firebase project) -->
Debug output
** Errors in the JavaScript console **
** Output from
firebase.database().enableLogging(true);
**** Screenshots **
Expected behavior
Get the same result that Firebase SDK gives.
Actual behavior
No console errors, no result.
The text was updated successfully, but these errors were encountered: