diff --git a/samples/preview-snippets/src/main/java/com/example/firestore/PipelineSnippets.java b/samples/preview-snippets/src/main/java/com/example/firestore/PipelineSnippets.java index aeb373747..1af8226ce 100644 --- a/samples/preview-snippets/src/main/java/com/example/firestore/PipelineSnippets.java +++ b/samples/preview-snippets/src/main/java/com/example/firestore/PipelineSnippets.java @@ -47,6 +47,29 @@ class PipelineSnippets { this.firestore = firestore; } + public void typeAndGenericFunctions() { + // [START type_function] + Expression typeOfField = field("rating").type(); + // [END type_function] + + // [START concat_function] + Expression displayString = constant("Author ID: ").concat(field("authorId")); + // [END concat_function] + + // [START length_function] + Expression tagsCount = field("tags").length(); + // [END length_function] + + // [START reverse_function] + Expression reversedTags = field("tags").reverse(); + // [END reverse_function] + + System.out.println(typeOfField); + System.out.println(displayString); + System.out.println(tagsCount); + System.out.println(reversedTags); + } + void queryExplain() throws ExecutionException, InterruptedException { // [START query_explain] Query q = firestore.collection("cities").whereGreaterThan("population", 1);