morrislaptop / firestore-php

Firestore SDK for PHP without gRPC
MIT License
67 stars 31 forks source link

How can you do queries like 'where'? #9

Open morksinaanab opened 5 years ago

morksinaanab commented 5 years ago

when I try where, it gives an error: Call to undefined method Morrislaptop\Firestore\CollectionReference::where()

I only see the method 'documents()' in the Query object. Is the rest not implemented? or am i missing something?

I'm looking for reference here: https://firebase.google.com/docs/firestore/query-data/queries

morrislaptop commented 5 years ago

Not implemented. PR welcome!

radzzii commented 5 years ago

WHAT A GREAT VENDOR. thanks mate!

alifaraun commented 3 years ago

Is not available yet ?

ronlinet commented 1 month ago

This hack does the job


            $collection     = $this->firestore->collection( $collectionName )->documents(); 
            $querySnapshot = $collection->getIterator(); 

            foreach ($querySnapshot as $document) {
                if ($document->data()[$attribute] === $value) {
                    $document->reference()->delete();
                }
            }