From 47b6979e9505400d16f6ad4d7a6b7fa481bb5000 Mon Sep 17 00:00:00 2001 From: Morgan Chen Date: Fri, 31 Oct 2025 16:29:26 -0700 Subject: [PATCH 1/2] remove nan snippets --- .../PipelineSnippets.swift | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/firestore/swift/firestore-smoketest/PipelineSnippets.swift b/firestore/swift/firestore-smoketest/PipelineSnippets.swift index 0e138fb..8a10500 100644 --- a/firestore/swift/firestore-smoketest/PipelineSnippets.swift +++ b/firestore/swift/firestore-smoketest/PipelineSnippets.swift @@ -959,32 +959,6 @@ public class PipelineSnippets { print(result) } - // https://cloud.google.com/firestore/docs/pipeline/functions/logical_functions#is_nan - func isNaNFunction() async throws { - // [START is_nan] - let result = try await db.pipeline() - .collection("books") - .select([ - Field("rating").isNan().as("hasInvalidRating") - ]) - .execute() - // [END is_nan] - print(result) - } - - // https://cloud.google.com/firestore/docs/pipeline/functions/logical_functions#is_not_nan - func isNotNaNFunction() async throws { - // [START is_not_nan] - let result = try await db.pipeline() - .collection("books") - .select([ - Field("rating").isNotNan().as("hasValidRating") - ]) - .execute() - // [END is_not_nan] - print(result) - } - // https://cloud.google.com/firestore/docs/pipeline/functions/logical_functions#max func maxLogicalFunction() async throws { // [START max_logical_function] From 117b40e55fb2c589c9c5e6c989a9629ff0a78ae9 Mon Sep 17 00:00:00 2001 From: Morgan Chen Date: Tue, 4 Nov 2025 14:04:18 -0800 Subject: [PATCH 2/2] add basic read snippet --- .../firestore-smoketest/PipelineSnippets.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/firestore/swift/firestore-smoketest/PipelineSnippets.swift b/firestore/swift/firestore-smoketest/PipelineSnippets.swift index 8a10500..54922d9 100644 --- a/firestore/swift/firestore-smoketest/PipelineSnippets.swift +++ b/firestore/swift/firestore-smoketest/PipelineSnippets.swift @@ -27,6 +27,24 @@ public class PipelineSnippets { pipelineConcepts() } + func basicRead() async throws { + do { + // Initialize a Firestore Pipeline instance and specify the "users" collection as the + // input stage. + let snapshot = try await db.pipeline() + .collection("users") + .execute() // Execute the pipeline to retrieve documents. + + // Iterate through the documents in the pipeline results, similar to a regular query + // snapshot. + for result in snapshot.results { + print("\(result.id ?? "no ID") => \(result.data)") + } + } catch { + print("Error getting documents with pipeline: \(error)") + } + } + // https://cloud.google.com/firestore/docs/pipeline/overview#concepts func pipelineConcepts() { // [START pipeline_concepts]