From 9ebcb056ec005c3097bac5648e39a03412ebe6bd Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 25 Sep 2024 12:17:31 -0700 Subject: [PATCH] chore(firestore): Add firestore_query_filter_compound_multi_ineq to samples --- google-cloud-firestore/samples/query_data.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/google-cloud-firestore/samples/query_data.rb b/google-cloud-firestore/samples/query_data.rb index 9501aacf7766..0f8c6cb9a0d6 100644 --- a/google-cloud-firestore/samples/query_data.rb +++ b/google-cloud-firestore/samples/query_data.rb @@ -27,6 +27,7 @@ def query_create_examples project_id:, collection_path: "cities" state: "CA", country: "USA", capital: false, + density: 18_000, population: 860_000, regions: ["west_coast", "norcal"] } @@ -37,6 +38,7 @@ def query_create_examples project_id:, collection_path: "cities" state: "CA", country: "USA", capital: false, + density: 8_300, population: 3_900_000, regions: ["west_coast", "socal"] } @@ -47,6 +49,7 @@ def query_create_examples project_id:, collection_path: "cities" state: nil, country: "USA", capital: true, + density: 11_300, population: 680_000, regions: ["east_coast"] } @@ -57,6 +60,7 @@ def query_create_examples project_id:, collection_path: "cities" state: nil, country: "Japan", capital: true, + density: 16_000, population: 9_000_000, regions: ["kanto", "honshu"] } @@ -67,6 +71,7 @@ def query_create_examples project_id:, collection_path: "cities" state: nil, country: "China", capital: true, + density: 3_500, population: 21_500_000, regions: ["jingjinji", "hebei"] } @@ -183,6 +188,17 @@ def invalid_range_query project_id:, collection_path: "cities" # [END firestore_query_filter_range_invalid] end +def firestore_query_filter_compound_multi_ineq project_id:, collection_path: "cities" + # project_id = "Your Google Cloud Project ID" + # collection_path = "cities" + + firestore = Google::Cloud::Firestore.new project_id: project_id + cities_ref = firestore.col collection_path + # [START firestore_query_filter_compound_multi_ineq] + invalid_range_query = cities_ref.where("population", ">", 1_000_000).where("density", "<", 1_000) + # [END firestore_query_filter_compound_multi_ineq] +end + def in_query_without_array project_id:, collection_path: "cities" # project_id = "Your Google Cloud Project ID" # collection_path = "cities"