-
Notifications
You must be signed in to change notification settings - Fork 418
Add pipeline snippets #661
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
base: master
Are you sure you want to change the base?
Conversation
| // [START field_or_constant] | ||
| Pipeline pipeline = db.pipeline() | ||
| .collection("cities") | ||
| .where(Expression.field("name").equal(Expression.constant("Toronto"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to setup an example to explain Expression.field/constant are just static functions you can import directly, then update the following examples without Expression. to make it more concise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I think we can leave out the example and assume devs will know how to import it unless we start getting questions otherwise.
| } | ||
|
|
||
| // https://cloud.google.com/firestore/docs/pipeline/overview#creating_indexes | ||
| void creatingIndexes() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this called creatingIndexes? I imagine the context text to explain this will be from difference source?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The context is in the commented link above the file: https://cloud.google.com/firestore/docs/pipeline/overview#creating_indexes
It's just an example of a pipeline that would benefit from the creation of a particular index.
| .collection("cities/NY/restaurants") | ||
| .where(Expression.field("type").equal("Italian"))) | ||
| .where(Expression.field("rating").greaterThanOrEqual(4.5)) | ||
| .sort(Expression.field("__name__").descending()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
People probably dont know what "name" is, you can use FieldPath.documentId() instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem to let me do FieldPath.documentId().descending(), maybe because FieldPath isn't an Expression?
Build fails because there's no prerelease Firestore on local maven, but passes locally.