Skip to content

Conversation

@morganchen12
Copy link
Contributor

@morganchen12 morganchen12 commented Oct 31, 2025

Build fails because there's no prerelease Firestore on local maven, but passes locally.

// [START field_or_constant]
Pipeline pipeline = db.pipeline()
.collection("cities")
.where(Expression.field("name").equal(Expression.constant("Toronto")));
Copy link

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?

Copy link
Contributor Author

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() {
Copy link

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?

Copy link
Contributor Author

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())
Copy link

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.

Copy link
Contributor Author

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?

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

Successfully merging this pull request may close these issues.

2 participants