GoogleCloudPlatform / php-docs-samples

A collection of samples that demonstrate how to call Google Cloud services from PHP.
http://cloud.google.com/php
Apache License 2.0
965 stars 1.03k forks source link

feat(Firestore): add sample for multiple inequality filters #2029

Closed bshaffer closed 3 months ago

bshaffer commented 3 months ago
snippet-bot[bot] commented 3 months ago

Here is the summary of changes.

You are about to add 1 region tag. - [firestore/src/query_filter_compound_multi_ineq.php:47](https://github.com/GoogleCloudPlatform/php-docs-samples/blob/a2491ce18f59494b411c057f593b3b1bdb036da4/firestore/src/query_filter_compound_multi_ineq.php#L47), tag `firestore_query_filter_compound_multi_ineq`
You are about to delete 2 region tags. - [firestore/src/query_filter_range_invalid.php:40](https://github.com/GoogleCloudPlatform/php-docs-samples/blob/9160740eaf46b368cd44469a188189942dd7eb46/firestore/src/query_filter_range_invalid.php#L40), tag `firestore_query_filter_range_invalid` - [firestore/src/query_order_field_invalid.php:40](https://github.com/GoogleCloudPlatform/php-docs-samples/blob/9160740eaf46b368cd44469a188189942dd7eb46/firestore/src/query_order_field_invalid.php#L40), tag `firestore_query_order_field_invalid`

This comment is generated by snippet-bot. If you find problems with this result, please file an issue at: https://github.com/googleapis/repo-automation-bots/issues. To update this comment, add snippet-bot:force-run label or use the checkbox below:

clairekeer1997 commented 3 months ago

Hi Brent, this is Jia from Firestore queries team. Thanks for adding the examples for PHP! The example for Datastore looks good. But for FIrestore, this example query

        ->where('born', '>', 1900)
        ->where('born', '<', 1950);

only contains inequalities on a single field born. We need to have inequalities on different fields to be considered as a multiple inequalities query. For example, age > 20 AND height > 60 is a query with multiple inequalities.

bshaffer commented 3 months ago

@clairekeer1997 hi Jia. If you click the "Files Changed", you can see the actual sample. What you're referring to is not part of this sample, which looks like this:

    $chainedQuery = $collection
        ->where('age', '>', 35)
        ->where('height', '>', 60)
        ->where('height', '<', 70);
clairekeer1997 commented 3 months ago

Sorry I read on the wrong one. The updated example looks good to me.